Fix recent regression with destroying wxDataViewCtrl on app exit

As mentioned in the commit message of b628237245 (Fix crash due to using
wxLog during shutdown in a better way, 2024-01-26), this change could
affect existing code using wxTheApp and it did affect wxDataViewCtrl and
not in a good way: destroying it during application shutdown started to
crash now that wxTheApp is null when it happens.

Fix this by skipping the idle time notification when shutting down, it's
not useful anyhow by then.
This commit is contained in:
Vadim Zeitlin 2024-01-30 20:15:02 +01:00
parent cfb321b175
commit 6636a2ac9e

View file

@ -5605,7 +5605,10 @@ wxDataViewCtrl::~wxDataViewCtrl()
#if wxUSE_ACCESSIBILITY
SetAccessible(nullptr);
wxAccessible::NotifyEvent(wxACC_EVENT_OBJECT_DESTROY, this, wxOBJID_CLIENT, wxACC_SELF);
// There is no need to notify anybody if we're destroyed as part of
// application shutdown and doing it would just crash in this case.
if ( wxTheApp )
wxAccessible::NotifyEvent(wxACC_EVENT_OBJECT_DESTROY, this, wxOBJID_CLIENT, wxACC_SELF);
#endif // wxUSE_ACCESSIBILITY
}