Re: what to g_free and what to not.



on 8/21/00 8:27 AM, Oskar Liljeblad at osk@hem.passagen.se wrote:

> In the process of making Gnome-GCJ (GTK/Gnome bindings for Java) I have
> noticed that some methods that return strings (gchar*) sometimes allocate
> a string for you, while some return one from static storage. For example,
> gtk_widget_get_name basicly does "return widget->name", while
> gtk_widget_get_composite_name and many other strdup the string before
> returning it. Other examples are gtk_type_name which return a string
> which shouldn't be freed, and gtk_accelerator_name which strdup's.
> 
> It's only the functions that return gchar* that I have checked. There
> are others (for example those that retur gchar**) which need to checked
> too.

The "gtk_label_get_text() string duping" thread
<http://mail.gnome.org/pipermail/gtk-devel-list/2000-June/003639.html> is
all about this issue.

Read and enjoy.

    -- Darin






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