[Gtk-sharp-list] GLib.Global.ProgramName shouldn't be freed

Antonio Macrì ing.antonio.macri at gmail.com
Wed Apr 11 12:16:07 UTC 2012


As stated in GTK documentation about g_get_prgname 
(http://www.gtk.org/api/2.6/glib/glib-Miscellaneous-Utility-Functions.html#g-get-prgname) 
<http://www.gtk.org/api/2.6/glib/glib-Miscellaneous-Utility-Functions.html#g-get-prgname>:

     The returned string belongs to GLib and must not be modified or freed.

But the current implementation of GLib.Global.get_ProgramName is:

     get
     {
         return Marshaller.PtrToStringGFree(Global.g_get_prgname());
     }

In fact, when I try to use ProgramName, the first time it works well, 
but from the second on it contains garbage.

The same problem seems to affect ApplicationName, although the GTK 
documentation doesn't explicitly say that it must not be freed.

Regards,
Antonio


More information about the Gtk-sharp-list mailing list