GtkWindow destroy problem
- From: Martin Baulig <martin home-of-linux org>
- To: gtk-devel-list gnome org
- Subject: GtkWindow destroy problem
- Date: 05 Sep 2001 16:52:34 +0200
Hi,
the following code crashes:
====
window = g_object_new (GTK_TYPE_WINDOW, NULL);
g_object_unref (G_OBJECT (window));
====
Debugging shows me:
=====
g_object_unref (_object=0x80ee7d8) at gobject.c:1312
g_object_last_unref (object=0x80ee7d8) at gobject.c:421
gtk_window_dispose (object=0x80ee7d8) at gtkwindow.c:1363
gtk_widget_dispose (object=0x80ee7d8) at gtkwidget.c:5155
gtk_object_dispose (gobject=0x80ee7d8) at gtkobject.c:368
gtk_window_destroy (object=0x80ee7d8) at gtkwindow.c:2787
gtk_container_destroy (object=0x80ee7d8) at gtkcontainer.c:714
gtk_widget_real_destroy (object=0x80ee7d8) at gtkwidget.c:5174
gtk_object_real_destroy (object=0x80ee7d8) at gtkobject.c:388
=====
Now the object is finally dead.
When we return from the emission of the "destroy" signal in
gtk_object_dispose() (gtkobject.c:379), the object doesn't exist
anymore and it crashes:
====
gtk_object_dispose (gobject=0x80ee7d8) at gtkobject.c:379
379 GTK_OBJECT_UNSET_FLAGS (object, GTK_DESTROYED);
====
Btw. changing the code to
====
window = g_object_new (GTK_TYPE_WINDOW, NULL);
gtk_object_destroy (GTK_OBJECT (window));
====
works just fine.
However, I still call this a serious bug - a GtkWindow is a GObject and
thus g_object_unref() on it must not crash.
This also causes some trouble in my guile bindings: I have a guile module
(gnome gobject) which doesn't know anything about Gtk+ but which knows how
to deal with GObjects. In the (gnome gtk) module, of course, I want to
re-use the GObject code from (gnome gobject) rather than implementing a whole
new datatype from GtkWidgets.
So in my code, creating and freeing the GtkWindow happens in a module which
doesn't link against Gtk+ at all.
--
Martin Baulig
martin gnome org (private)
baulig suse de (work)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]