X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bfac8499858dbb52ae4e712b718dcd08e777b4c2..bd1e9c12b18a09228ddfb94c386677f686ce08b4:/src/common/wincmn.cpp?ds=sidebyside diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 87709ad66a..2665e8d0ec 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -191,6 +191,16 @@ wxWindowBase::~wxWindowBase() wxASSERT_MSG( GetChildren().GetCount() == 0, _T("children not destroyed") ); + // make sure that there are no dangling pointers left pointing to us + wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); + if ( panel ) + { + if ( panel->GetLastFocus() == this ) + { + panel->SetLastFocus((wxWindow *)NULL); + } + } + #if wxUSE_CARET if ( m_caret ) delete m_caret;