After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 92185 - GnomeMDI Crashes
GnomeMDI Crashes
Status: RESOLVED FIXED
Product: libgnomeui
Classification: Deprecated
Component: general
2.0.x
Other Linux
: Normal blocker
: future
Assigned To: Anders Carlsson
Anders Carlsson
Depends on:
Blocks:
 
 
Reported: 2002-08-31 15:06 UTC by Ecmel Ercan
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.0



Description Ecmel Ercan 2002-08-31 15:06:23 UTC
Hi,

I know the GnomeMDI framework is deprecated in Gnome 2.0 but I really
like the simplicity of the interface so I decided to work on it.  But
when destroying the GnomeMDI (GtkObject) the program always crashes. 
Also, when removing children, there is a warning about removing a
floating reference.  I tracked down the problem and found a solution.

Since GnomeMDI is a GtkObject descendant it has a floating reference
when it is created and it does not get removed since it has never been
added in a container widget.  If you call g_object_unref on it there
will be complications.  In order to remove the floating reference (and
finalize the object) the following changes may help:

gnome-mdi.c

AROUND LINE 252

REMOVE:

//      if (G_OBJECT (object)->ref_count > 0)
//              g_object_unref(object);

ADD:

        gtk_object_sink (GTK_OBJECT(object));



AROUND LINE 1466

REMOVE:

//      g_object_unref(G_OBJECT(child));

ADD:
        gtk_object_sink(GTK_OBJECT(child));


After those changes the crashes disappear and all finalizations are done.
Comment 1 Kjartan Maraas 2003-05-12 20:22:29 UTC
Jaka, could you take a look at the suggested fix here please?
Comment 2 Jaka Mocnik 2003-05-15 10:13:02 UTC
well, the Right Way(tm) to do this would be to make GnomeMDI in
GnomeMDIChild descendants of GObject instead of GtkObject. but since
the MDI API is deprecated, I won't bother.

the patch however serves its purpose: finalizations are done and the
thing doesn't crash. I applied it to libgnomeui: HEAD, gnome-2-2 and
gnome-2-0 branches.