Re: gtk_object_remove_all_data ?
- From: Vladimir Tsichevski <wowa jet msk su>
- To: hvv hippo ru
- Cc: Florent Devin lifl fr, gtk-list gnome org
- Subject: Re: gtk_object_remove_all_data ?
- Date: Tue, 19 Sep 2000 15:29:45 +0400
>> >
>> >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?
>
Gtk+ uses the objects of type GQuark (sort of atoms) as hash table
keys. Quarks might be only created, never destroyed. So the
"memory taken by strings used as keys" is always wasted for as long as
the strings differ.
As to the object data, it surely would be lost :-(
After a one more dig into the sources I found the right call is
g_datalist_clear(&object->object_data);
> Best regards,
> -Vlad
Regards,
Vladimir V. Tsichevski
senior expert
-----------------------------------------------------
Jet Infosystems
Krasnoproletarskaya 6, Tel. (+7 095) 972-1182
Moscow 103006, Russia Fax (+7 095) 972-0791
-----------------------------------------------------
Any opinions or recommendations herein are those of
the author and not of his computer.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]