Re: Memory question



Hi,

Am I doing the same ( memory leaking ) with g_strdup_printf ?
If so what is the better way to write the following code: ?

response = ShowGtkMessageDialog (GTK_WINDOW (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,
                g_strdup_printf ("%s",g_strerror(errno)) );
                return;

Thank you,
Colossus

Allin Cottrell wrote:
Yes, since the allocated string will not be freed by gtk_entry_set_text().

gchar *text = g_strdup_printf("banana %d", i);
gtk_entry_set_text(GTK_ENTRY(entry), text);
g_free(text);

Allin Cottrell
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/




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