correction after the previous commit which introduced bug 1888014
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51574 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -367,26 +367,32 @@ wxWindow *wxButton::SetDefault()
|
|||||||
return winOldDefault;
|
return winOldDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
// special version of wxGetTopLevelParent() which is safe to call when the
|
// return the top level parent window if it's not being deleted yet, otherwise
|
||||||
// parent is being destroyed: wxGetTopLevelParent() would just return NULL in
|
// return NULL
|
||||||
// this case because wxWindow version of IsTopLevel() is used when it's called
|
|
||||||
// during window destruction instead of wxTLW one, but we want to distinguish
|
|
||||||
// between these cases
|
|
||||||
static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win)
|
static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win)
|
||||||
{
|
{
|
||||||
for ( ; win; win = win->GetParent() )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
if ( win->IsTopLevel() )
|
// IsTopLevel() will return false for a wxTLW being deleted, so we also
|
||||||
|
// need the parent test for this case
|
||||||
|
wxWindow * const parent = win->GetParent();
|
||||||
|
if ( !parent || win->IsTopLevel() )
|
||||||
{
|
{
|
||||||
if ( win->IsBeingDeleted() )
|
if ( win->IsBeingDeleted() )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
win = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT_MSG( win, _T("button without top level parent?") );
|
wxASSERT_MSG( win, _T("button without top level parent?") );
|
||||||
|
|
||||||
return wxDynamicCast(win, wxTopLevelWindow);
|
wxTopLevelWindow * const tlw = wxDynamicCast(win, wxTopLevelWindow);
|
||||||
|
wxASSERT_MSG( tlw, _T("logic error in GetTLWParentIfNotBeingDeleted()") );
|
||||||
|
|
||||||
|
return tlw;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set this button as being currently default
|
// set this button as being currently default
|
||||||
|
Reference in New Issue
Block a user