]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appbase.cpp
fix memory leak in wxScreenDC, fixes #13249
[wxWidgets.git] / src / common / appbase.cpp
index 86b87c16cb2f3ad61229f429ca01920cac85c51e..194d0793acf80d32df46492c2bd49899f04e35e0 100644 (file)
@@ -345,8 +345,11 @@ bool wxAppConsoleBase::Dispatch()
 bool wxAppConsoleBase::Yield(bool onlyIfNeeded)
 {
     wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
 bool wxAppConsoleBase::Yield(bool onlyIfNeeded)
 {
     wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
+    if ( loop )
+       return loop->Yield(onlyIfNeeded);
 
 
-    return loop && loop->Yield(onlyIfNeeded);
+    wxScopedPtr<wxEventLoopBase> tmpLoop(CreateMainLoop());
+    return tmpLoop->Yield(onlyIfNeeded);
 }
 
 void wxAppConsoleBase::WakeUpIdle()
 }
 
 void wxAppConsoleBase::WakeUpIdle()
@@ -370,6 +373,9 @@ bool wxAppConsoleBase::ProcessIdle()
     wxLog::FlushActive();
 #endif
 
     wxLog::FlushActive();
 #endif
 
+    // Garbage collect all objects previously scheduled for destruction.
+    DeletePendingObjects();
+
     return event.MoreRequested();
 }
 
     return event.MoreRequested();
 }
 
@@ -509,9 +515,6 @@ void wxAppConsoleBase::ProcessPendingEvents()
 
         wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker);
     }
 
         wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker);
     }
-
-    // Garbage collect all objects previously scheduled for destruction.
-    DeletePendingObjects();
 }
 
 void wxAppConsoleBase::DeletePendingEvents()
 }
 
 void wxAppConsoleBase::DeletePendingEvents()