From 1bf86c4b185ec3d8852153d01682ea5cfe2f2df5 Mon Sep 17 00:00:00 2001 From: Benjamin Williams Date: Tue, 16 Oct 2007 16:33:05 +0000 Subject: [PATCH] check if pane still exists before closing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/aui/framemanager.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 61f06e7809..2223316795 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -1092,8 +1092,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 @@ -3543,7 +3542,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); + } } } @@ -4352,7 +4359,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(); } }