Re: gtk_object_remove_all_data ?



On Tue, 19 Sep 2000, Vladimir Tsichevski wrote:

> >
> >Hi,
> >In gtk, you can associate data to an object like this :
> >gtk_object_set_data (object, string, pointer);
> >
> >But I want to know if it is possible to have a function which remove
> >all data from an object without doing a loop on all associate data ?
> >I ask this because I have a program that create its own association
> >between a canvas and pointer to canvas_item, but when I remove all
> >canvas_item the association still exist, so I have to remove all my
> >data
> >Regards,
> >-- Florent
> >
> 
> This IMHO should do
> 
>   g_datalist_init (&object->object_data);
> 
> or, which is equivalent
> 
>   object->object_data = NULL;

  Wouldn't this leak memory taken by strings used as keys and the data itself?
 
> But, I'm afraid, you'd better do not do such things at all, since
> doing that, you remove any properties that someone else has set (for
> example, glade assign names for objects using this property list).

  I agree here. 

> Vladimir V. Tsichevski
> senior expert
> 

 Best regards,
  -Vlad





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