X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/937013e0fd914d4c42f9f5ec98da665986b93dfa..9588640d1949eac482af93f761f6cdf43ef14c22:/src/x11/app.cpp diff --git a/src/x11/app.cpp b/src/x11/app.cpp index dad65db005..772abba8c6 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -25,6 +25,7 @@ #include "wx/memory.h" #include "wx/gdicmn.h" #include "wx/module.h" + #include "wx/crt.h" #endif #include "wx/evtloop.h" @@ -776,9 +777,7 @@ bool wxApp::Yield(bool onlyIfNeeded) int i; for (i = 0; i < 2; i++) { - static bool s_inYield = false; - - if ( s_inYield ) + if ( m_isInsideYield ) { if ( !onlyIfNeeded ) { @@ -788,17 +787,11 @@ bool wxApp::Yield(bool onlyIfNeeded) return false; } - s_inYield = true; + m_isInsideYield = true; // Make sure we have an event loop object, // or Pending/Dispatch will fail - wxEventLoopBase * const eventLoop = wxEventLoop::GetActive(); - wxEventLoop* newEventLoop = NULL; - if (!eventLoop) - { - newEventLoop = new wxEventLoop; - wxEventLoop::SetActive(newEventLoop); - } + wxEventLoopGuarantor dummyLoopIfNeeded; // Call dispatch at least once so that sockets // can be tested @@ -812,13 +805,7 @@ bool wxApp::Yield(bool onlyIfNeeded) #endif ProcessIdle(); - if (newEventLoop) - { - wxEventLoop::SetActive(NULL); - delete newEventLoop; - } - - s_inYield = false; + m_isInsideYield = false; } return true;