]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed menu destruction if it was removed from menubar with Remove
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 3 Oct 2004 21:00:45 +0000 (21:00 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 3 Oct 2004 21:00:45 +0000 (21:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/menu.cpp
src/gtk1/menu.cpp

index 83ba105c0095807db4616ea76ddeccc3f08f3a11..c72c5a8ee20782ca23730d812e3dbc746f18bd77 100644 (file)
@@ -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 );
    }
 }
 
index 83ba105c0095807db4616ea76ddeccc3f08f3a11..c72c5a8ee20782ca23730d812e3dbc746f18bd77 100644 (file)
@@ -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 );
    }
 }