]> git.saurik.com Git - wxWidgets.git/commitdiff
Better fix for avoiding warnings from Ubuntu libdbusmenu
authorPaul Cornett <paulcor@bullseye.com>
Thu, 27 Dec 2012 05:28:32 +0000 (05:28 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Thu, 27 Dec 2012 05:28:32 +0000 (05:28 +0000)
Previous workaround from r71648, modified in r72560, broke MDI child menu handling
See #14292

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/menu.cpp

index fe3a0c1d68a7caddfa379e7b0514da6aeb1c4fdf..999894eeb40d6f2deec9efcf1cb82eedfaefa877 100644 (file)
@@ -70,16 +70,6 @@ static void DoCommonMenuCallbackCode(wxMenu *menu, wxMenuEvent& event)
 
 wxMenuBar::~wxMenuBar()
 {
-    if (m_widget && IsAttached())
-    {
-        // Work around a probable bug in Ubuntu 12.04 which causes a warning if
-        // gtk_widget_destroy() is called on a wxMenuBar attached to a frame
-        GtkWidget* widget = m_widget;
-        m_focusWidget =
-        m_widget = NULL;
-        GTKDisconnect(widget);
-        g_object_unref(widget);
-    }
 }
 
 void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style)
@@ -342,8 +332,11 @@ wxMenu *wxMenuBar::Remove(size_t pos)
     if ( !menu )
         return NULL;
 
-    gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu->m_owner), NULL);
+    // remove item from menubar before destroying item to avoid spurious
+    // warnings from Ubuntu libdbusmenu
     gtk_container_remove(GTK_CONTAINER(m_menubar), menu->m_owner);
+    // remove submenu to avoid destroying it when item is destroyed
+    gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu->m_owner), NULL);
 
     gtk_widget_destroy( menu->m_owner );
     menu->m_owner = NULL;
@@ -775,7 +768,7 @@ wxMenu::~wxMenu()
     // if the menu is inserted in another menu at this time, there was
     // one more reference to it:
     if (m_owner)
-       gtk_widget_destroy(m_menu);
+       gtk_widget_destroy(m_owner);
 
     g_object_unref(m_accel);
 }