X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6afafc42fcf42ce84c9e1c0a7c00d3a0376d1aef..889f0b7c67f207f230d8bf9f558ae35445d57e10:/src/msw/app.cpp diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 399e734e84..ed4d736788 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -601,7 +601,9 @@ void wxApp::CleanUp() #if wxUSE_THREADS delete wxPendingEventsLocker; // If we don't do the following, we get an apparent memory leak. +#if wxUSE_VALIDATORS ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker(); +#endif #endif wxClassInfo::CleanUpClasses(); @@ -1058,6 +1060,12 @@ bool wxApp::ProcessMessage(WXMSG *wxmsg) { if ( wnd->MSWTranslateMessage(wxmsg) ) return TRUE; + + // stop at first top level window, i.e. don't try to process the key + // strokes originating in a dialog using the accelerators of the parent + // frame - this doesn't make much sense + if ( wnd->IsTopLevel() ) + break; } // Anyone for a non-translation message? Try youngest descendants first. @@ -1280,12 +1288,22 @@ void wxExit() } // Yield to incoming messages + +static bool gs_inYield = FALSE; + bool wxYield() { // disable log flushing from here because a call to wxYield() shouldn't // normally result in message boxes popping up &c wxLog::Suspend(); +#ifdef __WXDEBUG__ + if (gs_inYield) + wxFAIL_MSG( wxT("wxYield called recursively" ) ); +#endif + + gs_inYield = TRUE; + // we don't want to process WM_QUIT from here - it should be processed in // the main event loop in order to stop it MSG msg; @@ -1307,9 +1325,20 @@ bool wxYield() // let the logs be flashed again wxLog::Resume(); + gs_inYield = FALSE; + return TRUE; } +// Yield to incoming messages; but fail silently if recursion is detected. +bool wxYieldIfNeeded() +{ + if (gs_inYield) + return FALSE; + + return wxYield(); +} + bool wxHandleFatalExceptions(bool doit) { #if wxUSE_ON_FATAL_EXCEPTION @@ -1319,7 +1348,8 @@ bool wxHandleFatalExceptions(bool doit) return TRUE; #else wxFAIL_MSG(_T("set wxUSE_ON_FATAL_EXCEPTION to 1 to sue this function")); - + + (void)doit; return FALSE; #endif }