Widget destroy process



Hi all !

I've just written a top-level widget, but I've got some troubles with
the destroy process. I've read the ref counting doc, so I know there's
some extra work needed by a top-level widget to be done and that's why
ref counting don't work for it. So I need to explicitly destroy it.

My destroy function do some job then call the destroy function of its
parent class, which goes in two asserts :

Gtk-CRITICAL **: file gtkcontainer.c: line 1247
(gtk_container_unregister_toplevel): assertion `node != NULL' failed.

Gtk-CRITICAL **: file gtkcontainer.c: line 622 (gtk_container_destroy):
assertion `GTK_IS_CONTAINER (object)' failed.

My questions :
1) What does it mean ? It seems the object is already destroyed.

2) I use the object_class->destroy field, but how does the destroy
process work ? I mean it executes the destroy function stuffs, then it
calls its parent one, which calls its parent one, ... (in "upward" mode)
tc until GtkObjectClass ? Then how does it work ? Does it also go
"downward", because my destroy function is called twice.

3) I've written another widget, but a non top-level one. I create an
instance with *_new, then I destroy it with *_unref, which calls
*_destroy. This destroy function calls *_destroy on the widget I was
talking at the beginning (the top-level one). After the top-level has
been destroyed (with the asserts I told), I've got the following ref
counting issue :

Gtk-CRITICAL **: file gtkobject.c: line 1179 (gtk_object_unref):
assertion `object->ref_count > 0' failed.

I don't understand, because the *_new function brought my a ref_count =
1, and then I only *_unref it once. Any idea about this one too ?


Hope I didn't explained too bad the problems :)

Thanks for your support,

--Stef





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