Re: gtk-2 bug, inconsistency or simply misunderstanding on my side ?



Olivier Fourdan wrote:

(resent 'cuz original message was sent from the wrong mailbox - Sorry, list moderators....)
--
Hi Owen, Olexiy,

Here comes my example. It's based on gtkdial.

Get the source from http://www.xfce.org/archive/gtkdial.bug.tar.gz

Untar, compile with "make" and run it.

When you click on the button, you get the following message :

** Message: freeing dial widget (80724f8)
** Message: freeing dial widget (80724f8)

(dial_test:5926): Gtk-WARNING **: A floating object was finalized. This
means that someone
called g_object_unref() on an object that had only a floating
reference; the initial floating reference is not owned by anyone
and must be removed with gtk_object_sink() after a normal
reference is obtained with g_object_ref().


The trace (g_message) is located right in gtk_dial_destroy(). It shows
that the method is called twice on the same object (80724f8)

PS: The frame widget is destroyed with "gtk_widget_destroy()"

Hello, Olivier
GtkDial is buggy: there's a check before unreffing adjustment in destroy handler
if (dial->adjustment)
   g_object_unref(dial->adjustment);
but there's not dial->adjustment = NULL after unreffing, so right one code is:
if (dial->adjustment) {
   g_object_unref(dial->adjustment);
   dial->adjustment = NULL;    /* missed there */
}
So, its doesn't matter whether you destroys frame, containing GtkDial or GtkDial
tself.
As Owen said there's a possibility that "destroy" handler can be called twice,
this happens only to 'real' handlers (pointed by GtkObjectClass->destroy) in
widgets realizations.

Olexiy




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