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
This commit is contained in:
Benjamin Williams 2006-07-16 12:32:51 +00:00
parent 0603bb285c
commit 2f68106fa0

View File

@ -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;
}