Avoid crashes in wxMSW when using buttons without valid parent.
Child controls such as buttons are supposed to always have a valid parent but if, somehow, they don't, still don't crash in wxMSW button code but just trigger an assert failure instead of unavailable button top level parent instead. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -277,7 +277,7 @@ static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win)
|
|||||||
// set this button as being currently default
|
// set this button as being currently default
|
||||||
void wxButton::SetTmpDefault()
|
void wxButton::SetTmpDefault()
|
||||||
{
|
{
|
||||||
wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(GetParent());
|
wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(this);
|
||||||
if ( !tlw )
|
if ( !tlw )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ void wxButton::SetTmpDefault()
|
|||||||
// unset this button as currently default, it may still stay permanent default
|
// unset this button as currently default, it may still stay permanent default
|
||||||
void wxButton::UnsetTmpDefault()
|
void wxButton::UnsetTmpDefault()
|
||||||
{
|
{
|
||||||
wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(GetParent());
|
wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(this);
|
||||||
if ( !tlw )
|
if ( !tlw )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user