patch to fix destroy_notify feature in bonobo



My implementation of destroy_notify is broken. I noticed a storage leak in
Nautilus and tracked it down to my flawed first cut at this feature. Here's
a (tested) fix.

I'll commit tomorrow unless someone tells me not to.

Index: bonobo/bonobo-uih-menu.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-uih-menu.c,v
retrieving revision 1.20
diff -p -u -r1.20 bonobo-uih-menu.c
--- bonobo/bonobo-uih-menu.c    2000/08/02 21:31:29    1.20
+++ bonobo/bonobo-uih-menu.c    2000/08/09 02:26:36
@@ -204,9 +204,6 @@ menu_free_data (BonoboUIHandlerMenuItem
     item->hint  = NULL;
     
     bonobo_ui_handler_pixmap_free_data (item->pixmap_type,
item->pixmap_data);
-
-    if (item->callback_data_destroy_notify != NULL)
-        (* item->callback_data_destroy_notify) (item->callback_data);
 }
 
 static void
@@ -528,6 +525,8 @@ menu_local_remove_item (BonoboUIHandler
         g_free ((char *) curr->data);
     }
     g_list_free (internal_cb->children);
+    if (internal_cb->callback_data_destroy_notify != NULL)
+        (* internal_cb->callback_data_destroy_notify)
(internal_cb->callback_data);
     g_free (internal_cb);
 
     /*
Index: bonobo/bonobo-uih-toolbar.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-uih-toolbar.c,v
retrieving revision 1.20
diff -p -u -r1.20 bonobo-uih-toolbar.c
--- bonobo/bonobo-uih-toolbar.c    2000/07/15 21:01:11    1.20
+++ bonobo/bonobo-uih-toolbar.c    2000/08/09 02:26:37
@@ -261,10 +261,6 @@ toolbar_free_data (BonoboUIHandlerToolba
     item->hint = NULL;
 
     bonobo_ui_handler_pixmap_free_data (item->pixmap_type,
item->pixmap_data);
-
-    if (item->callback_data_destroy_notify != NULL) {
-        (* item->callback_data_destroy_notify) (item->callback_data);
-    }
 }
 
 static void
@@ -1767,6 +1763,11 @@ toolbar_local_remove_item (BonoboUIHandl
 
     if (l == NULL)
         return;
+
+    /*
+     * FIXME: Menu item code frees the MenuItemLocalInternal here.
+     * Doesn't this code need something similar?
+     */
 
     /*
      * Remove the list link.
===================================================================

    -- Darin





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