patch for ownership problem in bonobo-uih-menu.c



Here's another patch for a problem Nautilus has run into with bonobo menus.
When quitting, the bonobo menu items are destroyed in the normal way by the
widget hierarchy being torn down, then they get accessed in bonobo and spew
GTK-CRITICALs all over the place.

Should I go ahead and commit this simple change? I'm not sure if there's
some other solution, but these two gtk_object_ref calls fix the symptom.

John

====

ChangeLog entry:

2000-03-07  John Sullivan  <sullivan@eazel.com>

        * bonobo/bonobo-uih-menu.c:
        (menu_toplevel_create_widgets): ref menu_widget and menu
        before storing them in hash tables, to avoid double-deletion
        on quit.

====

Patch:

Index: bonobo/bonobo-uih-menu.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-uih-menu.c,v
retrieving revision 1.2
diff -u -r1.2 bonobo-uih-menu.c
--- bonobo/bonobo-uih-menu.c    2000/03/07 01:07:31    1.2
+++ bonobo/bonobo-uih-menu.c    2000/03/07 23:46:37
@@ -904,6 +904,7 @@
      * in the hash table.
      */
     menu_widget = menu_toplevel_create_item_widget (uih, parent_path,
item);
+    gtk_object_ref (GTK_OBJECT (menu_widget));
     g_hash_table_insert (uih->top->path_to_menu_widget, g_strdup
(item->path), menu_widget);
 
     /*
@@ -951,6 +952,7 @@
          * Store the menu shell for later retrieval (e.g. when
          * we add submenu items into this shell).
          */
+        gtk_object_ref (GTK_OBJECT (menu));
         g_hash_table_insert (uih->top->path_to_menu_shell, g_strdup
(item->path), menu);
     }
 





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