Re: I did not know this leak memory or not (gtk_object_set_data)
- From: "J. Ali Harlow" <ali juiblex co uk>
- To: chao yeaj <yeajchao gmail com>
- Cc: gtk-app-devel-list gnome org, gtk-list gnome org
- Subject: Re: I did not know this leak memory or not (gtk_object_set_data)
- Date: Sun, 09 Jul 2006 17:34:25 +0100
On 2006-07-08 02:16:14 PM, chao yeaj wrote:
[please choose _one_ list and stick to it.]
Hello everyone
I use function ``gtk_object_set_data'' to set data to object
my code like this:
/***********************************************************************************/
guint *p = NULL;
p = g_malloc0(sizeof(guint)):
gtk_object_set_data(GTK_OBJECT(button),"key",p);
/*********************************************************************************/
I did not know whether I should add the following code or not
/***************************************************************/
g_free(p);
/*******************************************************************/
You should use:
p = g_malloc0(sizeof(guint));
g_object_set_data_full(G_OBJECT(button),
"key", p, (GDestroyNotify)g_free);
Ali.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]