Gtk-CRITICIAL message after destroying GtkSpinbutton



Hello All,

I am writing a GTK+ frontend for a new volume management system.
Part of the code deals with dynamic widget selection and creation
in a configuration notebook based upon feedback from a backend
plugin.

I am running RH 7.1 with GTK 1.2.10 and get the following after
destroying a GtkSpinbutton:

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

I also get a gtk_object_ref assertion with the same assertion message.
These two message repeat endlessly.

The sequence of events are:

1. Click on spinbutton button (arrows).
2. The "value-changed" event for the GtkAdjustment is received by
   my signal handler.
3. The signal handler communicates the new value to the backend plugin.
4. The backend plugin indicates that the change has altered the
   properties of other widgets.
5. The signal handler then adds an idle function to destroy and recreate
   the contents of the configuration notebook according to new input
   requirements.
6. When the one-time idle function runs, it destroys the widgets and
   recreates new ones.
7. At this point the flood of GtkCRITICAL messages appear.


The problem seems to be a timeout function was added by the GtkSpinbutton code which then runs every 50 milliseconds but
since the spinbutton is gone, never gets deregistered.

In my idle rebuild function I have the following code:

            if (GTK_IS_SPIN_BUTTON (info->widget))
            {
                GtkSpinButton *spin = GTK_SPIN_BUTTON (info->widget);

                if (spin->timer)
                {
                    gtk_timeout_remove (spin->timer);
                    spin->timer = 0;
                    spin->timer_calls = 0;
                    spin->need_timer = FALSE;
                }
            }

            gtk_widget_destroy (info->widget);

Doing this eliminates the Gtk-CRITICAL problem. Is this hack necessary because the GtkSpinbutton does not check to see if a timeout function is registered to deregister it before being destroyed?

Is this a GTK bug or am I doing something wrong?

regards,

Luciano Chavez
http://sf.net/projects/evms




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