GObject get_property method copying string
Tiago Katcipis <[email protected]> Thu, 11 Aug 2011 08:52:40 -0300
| Newsgroups | gmane.comp.gnome.devel |
|---|---|
| Message-ID | <CAOp59uPkHH89iO8MnP-gTU+YVELdutNz_jXRc8=p+yCbj8xJwQ@mail.gmail.com> |
Hi, I'm developing a library using GObject and I'm having trouble creating a string property that does not makes a copy when g_object_get is called. I used g_value_set_static_string to avoid the string from being copied, but doing some debug it seems that g_object_get is copying my string anyway. That is odd, because i see a lot of code using g_value_set_string on get_property, and that would produce a completely useless additional copy of the string (since g_object_get will copy it anyway). Sorry to bother with such a stupid question but the documentation just says: "In general, a copy is made of the property contents and the caller is responsible for freeing the memory in the appropriate manner for the type, for instance by calling g_free()<http://developer.gnome.org/glib/stable/glib/glib-Memory-Allocation.html#g-free>or g_object_unref()<http://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref>. " What would be "in general" ? Do i have some control of it ? (i was unable to find any) Am i understanding something wrong ? Best regards, Katcipis _______________________________________________ gnome-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-devel-list