]> git.saurik.com Git - wxWidgets.git/commitdiff
check if pane still exists before closing
authorBenjamin Williams <bwilliams@kirix.com>
Tue, 16 Oct 2007 16:33:30 +0000 (16:33 +0000)
committerBenjamin Williams <bwilliams@kirix.com>
Tue, 16 Oct 2007 16:33:30 +0000 (16:33 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49172 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/aui/framemanager.cpp

index 518eab1b33a04c15b8c579c8736f21085ff5b588..7c552d924392fe666b2c29010ce9a035007364e1 100644 (file)
@@ -1093,8 +1093,7 @@ bool wxAuiManager::DetachPane(wxWindow* window)
     return false;
 }
 
-// ClosePane() destroys or hides the pane depending on its
-// flags
+// ClosePane() destroys or hides the pane depending on its flags
 void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info)
 {
     // if we were maximized, restore
@@ -3532,7 +3531,15 @@ void wxAuiManager::OnFloatingPaneClosed(wxWindow* wnd, wxCloseEvent& evt)
     }
     else
     {
-        ClosePane(pane);
+        // close the pane, but check that it
+        // still exists in our pane array first
+        // (the event handler above might have removed it)
+
+        wxAuiPaneInfo& check = GetPane(wnd);
+        if (check.IsOk())
+        {
+            ClosePane(pane);
+        }
     }
 }
 
@@ -4343,7 +4350,16 @@ void wxAuiManager::OnPaneButton(wxAuiManagerEvent& evt)
 
         if (!e.GetVeto())
         {
-            ClosePane(pane);
+            // close the pane, but check that it
+            // still exists in our pane array first
+            // (the event handler above might have removed it)
+
+            wxAuiPaneInfo& check = GetPane(pane.window);
+            if (check.IsOk())
+            {
+                ClosePane(pane);
+            }
+            
             Update();
         }
     }