Don't send wxEVT_ACTIVATE to half-destroyed windows in wxMSW
This resulted in a crash when WM_ACTIVATE was received from inside wxWindow dtor, executed after wxTopLevelWindowMSW dtor, and passed to a handler defined in wxTopLevelWindowMSW and using its already destroyed members. Perhaps we should avoid dispatching any messages when the window is being destroyed, but it's not totally obvious that this is not going to break something, so for now apply just this minimal fix. Closes #18970.
This commit is contained in:
@@ -4296,6 +4296,14 @@ bool wxWindowMSW::HandleActivate(int state,
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_isBeingDeleted )
|
||||
{
|
||||
// Same goes for activation events sent to an already half-destroyed
|
||||
// window: this doesn't happen always, but can happen for a TLW using a
|
||||
// (still existent) hidden parent, see #18970.
|
||||
return false;
|
||||
}
|
||||
|
||||
wxActivateEvent event(wxEVT_ACTIVATE,
|
||||
(state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
|
||||
m_windowId,
|
||||
|
Reference in New Issue
Block a user