On 04/17/2009 02:48 PM, Fabrício Godoy wrote:
Please, how I avoid this leak?
I tried following, without success:
Glib::ustring win_NetworkInterface::get_name()
{
Glib::RefPtr<gchar> cname (g_utf16_to_utf8(
(gunichar2*) this->ifinfo.FriendlyName, -1, NULL, NULL, NULL));
Glib::ustring name(cname);
return name;
}
Without even the need for you to tell me to define "without success" (yes this is far to vague to even be a useful statement), I can tell you that you should re-read the documentation for Glib::RefPtr<> as you are misusing it.
*hint*: the doc for g_utf16_to_utf8() tells you that the pointer needs to be freed with g_free(). Why don't you just do that?
Hub