If a TLW's default item is not an immediate child then it can be left
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
This commit is contained in:
@@ -292,6 +292,18 @@ wxWindowBase::~wxWindowBase()
|
||||
|
||||
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 )
|
||||
{
|
||||
|
Reference in New Issue
Block a user