]> git.saurik.com Git - wxWidgets.git/commitdiff
make sure we don't execute pending deletes either when in runModel, otherwise reentra...
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 3 Jun 2013 14:57:56 +0000 (14:57 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 3 Jun 2013 14:57:56 +0000 (14:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74099 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/core/evtloop.h
src/osx/core/evtloop_cf.cpp

index cae3c8e78f89fd15b6642c12048419702c44f0a8..600c2056cdc242c1424dc9d460fa80f4994b9cce 100644 (file)
@@ -54,6 +54,7 @@ public:
       AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags);
 #endif // wxUSE_EVENTLOOP_SOURCE
 
+    bool ShouldProcessIdleEvents() const { return m_processIdleEvents ; }
 protected:
     void CommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity);
     void DefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity);
@@ -106,6 +107,8 @@ class WXDLLIMPEXP_BASE wxCFEventLoopPauseIdleEvents : public wxObject
 public:
     wxCFEventLoopPauseIdleEvents();
     virtual ~wxCFEventLoopPauseIdleEvents();
+private:
+    bool m_formerState;
 };
 
 #endif // _WX_OSX_EVTLOOP_H_
index 20f01f8fd6a3feae583e19667b6aed652bb53b8a..8d3ef5f84389c5ee284ada073078c74cbc7d1597 100644 (file)
@@ -163,13 +163,13 @@ void wxCFEventLoop::CommonModeObserverCallBack(CFRunLoopObserverRef WXUNUSED(obs
         // and this input is only removed from it when pending event handlers are
         // executed)
 
-        if ( wxTheApp )
+        if ( wxTheApp && ShouldProcessIdleEvents() )
             wxTheApp->ProcessPendingEvents();
     }
 
     if ( activity & kCFRunLoopBeforeWaiting )
     {
-        if ( m_processIdleEvents && ProcessIdle() )
+        if ( ShouldProcessIdleEvents() && ProcessIdle() )
         {
             WakeUp();
         }
@@ -445,14 +445,19 @@ wxCFEventLoopPauseIdleEvents::wxCFEventLoopPauseIdleEvents()
 {
     wxCFEventLoop* cfl = dynamic_cast<wxCFEventLoop*>(wxEventLoopBase::GetActive());
     if ( cfl )
+    {
+        m_formerState = cfl->ShouldProcessIdleEvents();
         cfl->SetProcessIdleEvents(false);
+    }
+    else
+        m_formerState = true;
 }
 
 wxCFEventLoopPauseIdleEvents::~wxCFEventLoopPauseIdleEvents()
 {
     wxCFEventLoop* cfl = dynamic_cast<wxCFEventLoop*>(wxEventLoopBase::GetActive());
     if ( cfl )
-        cfl->SetProcessIdleEvents(true);
+        cfl->SetProcessIdleEvents(m_formerState);
 }
 
 // TODO Move to thread_osx.cpp