control/control-frame patch



The bad news is that after Michael's change I couldn't get the old
bonobo_object_destroy call to work without doing double-frees, even though I
think he left it in specifically for us Nautilus hackers.

The good news is that it wasn't too hard for me to defang the circular
reference problem that created the need for the destroy call in the first
place. Here's a patch that does it.

The key is that the control should not keep a reference to the control
frame. The frame owns the control and not the other way around. here may be
similar issues with other frame/item pairs elsewhere, I didn't go after that
whole thing, just made it work for the one case that dogs Nautilus.

Index: bonobo/bonobo-control.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-control.c,v
retrieving revision 1.30
diff -p -u -r1.30 bonobo-control.c
--- bonobo/bonobo-control.c    2000/07/11 10:53:04    1.30
+++ bonobo/bonobo-control.c    2000/07/11 20:31:59
@@ -727,7 +727,6 @@ bonobo_control_destroy (GtkObject *objec
 
     CORBA_exception_init (&ev);
 
-    Bonobo_Unknown_unref (control->priv->control_frame, &ev);
     CORBA_Object_release (control->priv->control_frame, &ev);
 
     CORBA_exception_free (&ev);
@@ -816,11 +815,9 @@ bonobo_control_set_control_frame (Bonobo
     CORBA_exception_init (&ev);
 
     if (control->priv->control_frame != CORBA_OBJECT_NIL) {
-        Bonobo_Unknown_unref (control->priv->control_frame, &ev);
         CORBA_Object_release (control->priv->control_frame, &ev);
     }
     
-    Bonobo_Unknown_ref (control_frame, &ev);
     control->priv->control_frame = CORBA_Object_duplicate (control_frame,
&ev);
     
     CORBA_exception_free (&ev);
Index: bonobo/bonobo-object.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object.c,v
retrieving revision 1.66
diff -p -u -r1.66 bonobo-object.c
--- bonobo/bonobo-object.c    2000/07/11 10:53:04    1.66
+++ bonobo/bonobo-object.c    2000/07/11 20:32:00
@@ -116,8 +116,7 @@ bonobo_object_ref (BonoboObject *object)
 }
 
 /* Do not use this function, it is not what you want; see unref */
-#warning Make this static when we know Nautilus works.
-void
+static void
 bonobo_object_destroy (BonoboObject *object)
 {
     GnomeAggregateObject *ao;
===================================================================

    -- Darin





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