From: Benjamin Williams Date: Sun, 16 Jul 2006 12:32:51 +0000 (+0000) Subject: prevent some obscure wxAUI crashes after DetachPane() is used (crashes only happen... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2f68106fa056bbbba9bd370161e9e72397803bf0 prevent some obscure wxAUI crashes after DetachPane() is used (crashes only happen in rare cases) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index b5cc99fa93..3079df6dba 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -764,6 +764,24 @@ bool wxFrameManager::DetachPane(wxWindow* window) p.frame->Destroy(); p.frame = NULL; } + + // make sure there are no references to this pane in our uiparts, + // just in case the caller doesn't call Update() immediately after + // the DetachPane() call. This prevets obscure crashes which would + // happen at window repaint if the caller forgets to call Update() + int pi, part_count; + for (pi = 0, part_count = (int)m_uiparts.GetCount(); pi < part_count; ++pi) + { + wxDockUIPart& part = m_uiparts.Item(pi); + if (part.pane == &p) + { + m_uiparts.RemoveAt(pi); + part_count--; + pi--; + continue; + } + } + m_panes.RemoveAt(i); return true; }