]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appcmn.cpp
added wxUmaskChanger class and wxCHANGE_UMASK macro and use them instead of duplicati...
[wxWidgets.git] / src / common / appcmn.cpp
index 335d9ec82b70e4aef4131fc7fcd93da6437d85e7..146378d59fdc2a0abba2d481d6f419a3859d7a5a 100644 (file)
@@ -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();