Re: Doubt about free or dont free



Le vendredi 22 juillet 2005 à 16:31 -0300, Arx Henrique a écrit :
Hi all,

i have a GtkEntry with a signal "activate" and this handle:

void translate(GtkEntry *widget, gpointer *data) {
      const gchar *text;
      text = gtk_entry_get_text(widget);
      gui_app_notify_new(text);
      g_free(text);
      gtk_editable_delete_text(GTK_EDITABLE(widget), 0, -1);
}

my doubt is g_free or not g_free the text?

Just check the documentation:

http://developer.gnome.org/doc/API/2.2/gtk/GtkEntry.html#gtk-entry-get-text

"Returns :  a pointer to the contents of the widget as a string. This
string points to internally allocated storage in the widget and must not
be freed, modified or stored."

-- 
Germán Poó Caamaño
http://www.ubiobio.cl/~gpoo/




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