Do not unref GtkWidget of unattached wxMenuBar.

This results in the destruction of the widgets of all of its menu and when
wxMenu objects are themselves destroyed in the base class dtor, we try to
destroy their already destroyed widgets, resulting in critical GTK warnings.

Simply don't do anything in wxMenuBar dtor itself if the menu bar is not
attached to a frame as the workaround was only needed in case of destroying
attached menu bars.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72560 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-09-26 22:30:00 +00:00
parent e2f268db5c
commit 4fcad4fb6d

View File

@@ -63,7 +63,7 @@ static void DoCommonMenuCallbackCode(wxMenu *menu, wxMenuEvent& event)
wxMenuBar::~wxMenuBar()
{
if (m_widget)
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