send destroy events for children before they're fully destroyed; document SendDestroyEvent() and explain when to call it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58252 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -407,6 +407,8 @@ void wxWindowBase::SendDestroyEvent()
|
||||
|
||||
bool wxWindowBase::Destroy()
|
||||
{
|
||||
SendDestroyEvent();
|
||||
|
||||
delete this;
|
||||
|
||||
return true;
|
||||
@@ -435,11 +437,11 @@ bool wxWindowBase::DestroyChildren()
|
||||
|
||||
wxWindow *child = node->GetData();
|
||||
|
||||
// note that we really want to call delete and not ->Destroy() here
|
||||
// because we want to delete the child immediately, before we are
|
||||
// deleted, and delayed deletion would result in problems as our (top
|
||||
// level) child could outlive its parent
|
||||
delete child;
|
||||
// note that we really want to delete it immediately so don't call the
|
||||
// possible overridden Destroy() version which might not delete the
|
||||
// child immediately resulting in problems with our (top level) child
|
||||
// outliving its parent
|
||||
child->wxWindowBase::Destroy();
|
||||
|
||||
wxASSERT_MSG( !GetChildren().Find(child),
|
||||
wxT("child didn't remove itself using RemoveChild()") );
|
||||
|
Reference in New Issue
Block a user