Re: g_utf16_to_utf8
- From: Hubert Figuiere <hub figuiere net>
 
- To: Fabrício Godoy <skarllot gmail com>
 
- Cc: gtkmm-list gnome org
 
- Subject: Re: g_utf16_to_utf8
 
- Date: Fri, 17 Apr 2009 15:08:46 -0400
 
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
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]