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
This commit is contained in:
Benjamin Williams
2007-10-16 16:33:05 +00:00
parent e4d2c5d6fd
commit 1bf86c4b18

View File

@@ -1092,8 +1092,7 @@ bool wxAuiManager::DetachPane(wxWindow* window)
return false; return false;
} }
// ClosePane() destroys or hides the pane depending on its // ClosePane() destroys or hides the pane depending on its flags
// flags
void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info) void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info)
{ {
// if we were maximized, restore // if we were maximized, restore
@@ -3543,7 +3542,15 @@ void wxAuiManager::OnFloatingPaneClosed(wxWindow* wnd, wxCloseEvent& evt)
} }
else 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()) 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(); Update();
} }
} }