X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/04cc1e93edd19f0430f9681ef1fdaf81ccdabf8f..2c12c792f34998b8b9d96a3b6e5a09525c022d1c:/src/gtk/menu.cpp diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 83ba105c00..c72c5a8ee2 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -982,8 +982,12 @@ wxMenu::~wxMenu() if ( GTK_IS_WIDGET( m_menu )) { - gtk_widget_unref( m_menu ); // see wxMenu::Init - gtk_widget_destroy( m_menu ); + // see wxMenu::Init + gtk_widget_unref( m_menu ); + // 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 ); } }