with a dangling pointer when the child is deleted, so check for it in
the child's dtor.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41469
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
+ // reset the top-level parent's default item if it is this widget
+ if ( m_parent )
+ {
+ wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent((wxWindow*)this),
+ wxTopLevelWindow);
+
+ if ( tlw && tlw->GetDefaultItem() == this )
+ tlw->SetDefaultItem(NULL);
+ if ( tlw && tlw->GetTmpDefaultItem() == this )
+ tlw->SetTmpDefaultItem(NULL);
+ }
+
// reset the dangling pointer our parent window may keep to us
if ( m_parent )
{