]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/mdi.cpp
calling explicit base class constructor from copy constructor
[wxWidgets.git] / src / gtk / mdi.cpp
index 9511b2e22ddba44abddbaf1d8559db0188412a83..1a3c3f570de664e8b95f766876d939d06a1c876c 100644 (file)
@@ -123,7 +123,7 @@ void wxMDIParentFrame::OnInternalIdle()
             wxMenuBar *menu_bar = active_child_frame->m_menuBar;
             if (menu_bar)
             {
-                menu_bar->SetInvokingWindow(active_child_frame);
+                menu_bar->Attach(active_child_frame);
             }
         }
         m_justInserted = false;
@@ -149,7 +149,13 @@ void wxMDIParentFrame::OnInternalIdle()
                 {
                     if (menu_bar->Show(true))
                     {
-                        menu_bar->SetInvokingWindow( child_frame );
+                        // Attach() asserts if we call it for an already
+                        // attached menu bar so don't do it if we're already
+                        // associated with this frame (it would be nice to get
+                        // rid of this check and ensure that this doesn't
+                        // happen...)
+                        if ( menu_bar->GetFrame() != child_frame )
+                            menu_bar->Attach( child_frame );
                     }
                     visible_child_menu = true;
                 }
@@ -157,7 +163,7 @@ void wxMDIParentFrame::OnInternalIdle()
                 {
                     if (menu_bar->Show(false))
                     {
-                        menu_bar->UnsetInvokingWindow( child_frame );
+                        menu_bar->Detach();
                     }
                 }
             }
@@ -173,12 +179,12 @@ void wxMDIParentFrame::OnInternalIdle()
         if (visible_child_menu)
         {
             m_frameMenuBar->Show( false );
-            m_frameMenuBar->UnsetInvokingWindow( this );
+            m_frameMenuBar->Detach();
         }
         else
         {
             m_frameMenuBar->Show( true );
-            m_frameMenuBar->SetInvokingWindow( this );
+            m_frameMenuBar->Attach( this );
         }
     }
 }
@@ -377,6 +383,19 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
 
 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
 
+wxMDIClientWindow::~wxMDIClientWindow()
+{
+    // disconnect our handler because our ~wxWindow (which is going to be called
+    // after this dtor) will call DestroyChildren(); in turns our children
+    // ~wxWindow dtors will call wxWindow::Show(false) and this will generate
+    // a call to gtk_mdi_page_change_callback with an invalid parent
+    // (because gtk_mdi_page_change_callback expects a wxMDIClientWindow but
+    //  at that point of the dtor chain we are a simple wxWindow!)
+    g_signal_handlers_disconnect_by_func(m_widget,
+                                         (gpointer)gtk_mdi_page_change_callback,
+                                         GetParent());
+}
+
 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
 {
     if ( !PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||