patches for two destroy-related bug in Bonobo



Here's a patch to fix two bugs in Bonobo. Both of them have to do with
destroying.

The first part of the patch fixes a bug which occurs if the control frame is
destroyed quickly after the control is set up. It happens when the socket is
destroyed by the control frame before the control's idle function to destroy
the socket runs. The control destroys the socket in the case where the
control discovered that it's local and doesn't need a socket/plug pair.

The second part of the patch fixes a bug which occurs if a destroy handler
does a bonobo_object_ref/bonobo_object_idle_unref pair. Without the patch we
try to remove the same signal handler twice.

Both are straightforward fixes. I ran into the problems while writing new
Nautilus code (but of course I changed the Nautilus code so it will work
even without the fixes).

Index: bonobo/bonobo-control.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-control.c,v
retrieving revision 1.73
diff -p -u -r1.73 bonobo-control.c
--- bonobo/bonobo-control.c    2001/03/16 11:29:30    1.73
+++ bonobo/bonobo-control.c    2001/03/29 00:22:29
@@ -343,10 +343,10 @@ impl_Bonobo_Control_setWindowId (Portabl
         control->priv->destroy_idle_id = gtk_idle_add (
             idle_destroy_socket, control);
 
-        gtk_signal_connect (GTK_OBJECT (local_socket),
-                    "destroy",
-                    remove_destroy_idle,
-                    control);
+        gtk_signal_connect_while_alive (GTK_OBJECT (local_socket),
+                        "destroy",
+                        remove_destroy_idle,
+                        control, GTK_OBJECT (control));
 
 
         gtk_box_pack_end (GTK_BOX (socket_parent),
Index: bonobo/bonobo-object.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object.c,v
retrieving revision 1.102
diff -p -u -r1.102 bonobo-object.c
--- bonobo/bonobo-object.c    2001/02/22 18:49:02    1.102
+++ bonobo/bonobo-object.c    2001/03/29 00:22:31
@@ -167,8 +167,11 @@ bonobo_object_destroy (BonoboAggregateOb
 
     for (l = ao->objs; l; l = l->next) {
         GtkObject *o = l->data;
+        guint id = BONOBO_OBJECT (o)->priv->destroy_id;
 
-        gtk_signal_disconnect (o, BONOBO_OBJECT (o)->priv->destroy_id);
+        if (id)
+            gtk_signal_disconnect (o, id);
+        BONOBO_OBJECT (o)->priv->destroy_id = 0;
         if (o->ref_count >= 1)
             gtk_object_destroy (GTK_OBJECT (o));
         else
===================================================================

    -- Darin





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