Re: GObject get_property method copying string

On 08/11/11 13:52, Tiago Katcipis wrote:
> 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).
where is the extra copy being made in glib?

> 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
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list gnome org

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