From 6636a2ac9ecdc6b1a6dda0556319399648f01d2f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jan 2024 20:15:02 +0100 Subject: [PATCH] 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. --- src/generic/datavgen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index f5e111e519..d03300d7f0 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -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 }