From 07460370468e902d9d0d3346a767238a7a3a9ca4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 Oct 2004 12:11:19 +0000 Subject: [PATCH] destroy any TLWs still alive when the app terminates (avoids problems with classes unregistering under MSW and memory leaks everywhere) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/appcmn.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 335d9ec82b..146378d59f 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -128,9 +128,19 @@ wxAppBase::~wxAppBase() void wxAppBase::CleanUp() { - // one last chance for pending objects to be cleaned up + // clean up all the pending objects DeletePendingObjects(); + // and any remaining TLWs (they remove themselves from wxTopLevelWindows + // when destroyed, so iterate until none are left) + while ( !wxTopLevelWindows.empty() ) + { + // do not use Destroy() here as it only puts the TLW in pending list + // but we want to delete them now + delete wxTopLevelWindows.GetFirst()->GetData(); + } + + // undo everything we did in Initialize() above wxBitmap::CleanUpHandlers(); wxDeleteStockObjects(); -- 2.50.0