X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4629016dfb6b082542523aa70b3beff197a2d139..698b34facdbae62cce6b2c9837e698ef9c3fbe8c:/src/common/appcmn.cpp 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();