From: Benjamin Williams Date: Tue, 16 Oct 2007 16:33:30 +0000 (+0000) Subject: check if pane still exists before closing X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7da1b21e25158f1d9a8b1fde8af44f35df363425 check if pane still exists before closing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49172 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 518eab1b33..7c552d9243 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -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(); } }