On Sat, 8 Jul 2006 21:16:14 +0800
"chao yeaj" <[EMAIL PROTECTED]> wrote:

> 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)):
> 

from devhelp:
Warning
gtk_object_set_data is deprecated and should not be used in
newly-written code. Use g_object_set_data() instead.

> 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);
> /*******************************************************************/
> 
yes this code must be!

>      I need your hints
>  Any comments would be much appricated,thanks in advance

with g_object_set_data you can assosiate pointer with string, and only
value of pointer will be writed. I think there is not memory leak.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to