GTK 1.2 - gtk_object_unref() trouble



Hi,

while debugging some stuff this afternoon I found the
following:

====
void
gtk_object_unref (GtkObject *object)
{
  g_return_if_fail (object != NULL);
  g_return_if_fail (GTK_IS_OBJECT (object));
  g_return_if_fail (object->ref_count > 0);
  
  if (object->ref_count == 1)
    {
      gtk_object_destroy (object);
  
      g_return_if_fail (object->ref_count > 0);
    }
====

Isn't gtk_object_destroy() supposed to set the refcount to
zero thus making `object->ref_count > 0' always fail if the
object got correctly destroyed or do I miss something ?

Btw. I found this while I was wondering why

        plug = bonobo_plug_new (<whatever>);

        gtk_widget_destroy (plug);

works without problems but

        plug = bonobo_plug_new (<whatever>);

        gtk_object_unref (plug);

yields

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

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




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