GObject get_property method copying string



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() or 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]