Better fix for avoiding warnings from Ubuntu libdbusmenu
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
This commit is contained in:
@@ -70,16 +70,6 @@ static void DoCommonMenuCallbackCode(wxMenu *menu, wxMenuEvent& event)
|
|||||||
|
|
||||||
wxMenuBar::~wxMenuBar()
|
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)
|
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 )
|
if ( !menu )
|
||||||
return NULL;
|
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);
|
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 );
|
gtk_widget_destroy( menu->m_owner );
|
||||||
menu->m_owner = NULL;
|
menu->m_owner = NULL;
|
||||||
@@ -775,7 +768,7 @@ wxMenu::~wxMenu()
|
|||||||
// if the menu is inserted in another menu at this time, there was
|
// if the menu is inserted in another menu at this time, there was
|
||||||
// one more reference to it:
|
// one more reference to it:
|
||||||
if (m_owner)
|
if (m_owner)
|
||||||
gtk_widget_destroy(m_menu);
|
gtk_widget_destroy(m_owner);
|
||||||
|
|
||||||
g_object_unref(m_accel);
|
g_object_unref(m_accel);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user