Re: I did not know this leak memory or not (gtk_object_set_data)
- From: "Atanas Atanasov" <thenasko gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: I did not know this leak memory or not (gtk_object_set_data)
- Date: Sun, 9 Jul 2006 17:26:06 +0200
/***********************************************************************************/
guint *p = NULL;
p = g_malloc0(sizeof(guint)):
gtk_object_set_data(GTK_OBJECT(button),"key",p);
/*********************************************************************************/
Why would you allocate the size of a single guint??? If all you want
to store is an (unsigned) integer value simply convert it to gpointer
and store it straight away. If you need to store a pointer to an array
then allocate and specify a destroy callback using
g_object_set_data_full and in the function use g_free.
Atanas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]