From 1fb8d3621f19d74680430aaf74b2b67fecfc486e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 15 Oct 2020 23:53:12 +0200 Subject: [PATCH] Send wxEVT_DESTROY to children of wxAuiManager-associated window This fixes a regression introduced in f646532889 (Call wxAuiManager::UnInit() if associated frame is destroyed, 2020-07-18) since when children of a window managed by wxAuiManager didn't receive wxEVT_DESTROY any more because the manager intercepted it for its own needs. Closes #18938. --- src/aui/framemanager.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index e9aed4e5f0..b44b709319 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -3961,7 +3961,23 @@ void wxAuiManager::Repaint(wxDC* dc) void wxAuiManager::OnDestroy(wxWindowDestroyEvent& event) { if ( event.GetEventObject() == m_frame ) + { + wxWindow* const frame = m_frame; + UnInit(); + + // Just calling Skip() would be insufficient in this case, as by + // removing the event handler from the event handlers chain in UnInit() + // we'd still prevent the frame from getting this event, so we need to + // forward it to it manually. Note that this must be done after calling + // UnInit() to prevent infinite recursion. + if ( frame ) + frame->ProcessWindowEventLocally(event); + } + else + { + event.Skip(); + } } void wxAuiManager::OnPaint(wxPaintEvent& WXUNUSED(event))