]> git.saurik.com Git - wxWidgets.git/commitdiff
Delete pending objects in wxApp::ProcessPendingEvents() and not ProcessIdle().
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Nov 2010 01:22:56 +0000 (01:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Nov 2010 01:22:56 +0000 (01:22 +0000)
Move DeletePendingObjects() call from ProcessPendingEvents() to ProcessIdle()
to ensure that we delete the objects marked for destruction even if the
application is sitting in a tight OnIdle() loop, i.e. if the idle event
handler keeps requesting more events.

Also make sure that the event loop terminates if its OnExit() was called even
if the idle event handler continues to request more events.

Closes #12424.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/appbase.cpp
src/common/evtloopcmn.cpp

index 86b87c16cb2f3ad61229f429ca01920cac85c51e..34dbcf00895d548fba98903aa2485eeac7b08381 100644 (file)
@@ -370,6 +370,9 @@ bool wxAppConsoleBase::ProcessIdle()
     wxLog::FlushActive();
 #endif
 
+    // Garbage collect all objects previously scheduled for destruction.
+    DeletePendingObjects();
+
     return event.MoreRequested();
 }
 
@@ -509,9 +512,6 @@ void wxAppConsoleBase::ProcessPendingEvents()
 
         wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker);
     }
-
-    // Garbage collect all objects previously scheduled for destruction.
-    DeletePendingObjects();
 }
 
 void wxAppConsoleBase::DeletePendingEvents()
index 300a1885d1904eeb1d506a2d84d15a99b73cf07f..aa1aca9cbc95f51b7c65eb0940dfc070237bd945 100644 (file)
@@ -139,7 +139,7 @@ int wxEventLoopManual::Run()
 
                 // generate and process idle events for as long as we don't
                 // have anything else to do
-                while ( !Pending() && ProcessIdle() )
+                while ( !Pending() && ProcessIdle() && !m_shouldExit )
                     ;
 
                 // if the "should exit" flag is set, the loop should terminate