diff options
-rw-r--r-- | fpicker/source/win32/asyncrequests.cxx | 5 | ||||
-rw-r--r-- | include/vcl/winscheduler.hxx | 5 | ||||
-rw-r--r-- | vcl/source/app/winscheduler.cxx | 12 |
3 files changed, 19 insertions, 3 deletions
diff --git a/fpicker/source/win32/asyncrequests.cxx b/fpicker/source/win32/asyncrequests.cxx index 665c0d1d6dc7..cdcfb6d630e9 100644 --- a/fpicker/source/win32/asyncrequests.cxx +++ b/fpicker/source/win32/asyncrequests.cxx @@ -19,6 +19,7 @@ #include "asyncrequests.hxx" #include <vcl/svapp.hxx> +#include <vcl/winscheduler.hxx> #include <osl/mutex.hxx> namespace fpicker{ @@ -56,6 +57,10 @@ void Request::waitProcessMessages() void Request::notify() { m_aJoiner.set(); + // Make sure that main loop receives at least this message to return from GetMessage and recheck + // the condition, even in case when there's no visible application windows present, and thus no + // other messages might arrive to the main loop. + WinScheduler::PostDummyMessage(); } AsyncRequests::AsyncRequests(const RequestHandlerRef& rHandler) diff --git a/include/vcl/winscheduler.hxx b/include/vcl/winscheduler.hxx index 02d86116bb38..6f77f3a7b082 100644 --- a/include/vcl/winscheduler.hxx +++ b/include/vcl/winscheduler.hxx @@ -31,6 +31,11 @@ struct VCL_DLLPUBLIC WinScheduler final /// Hack for Windows native dialogs, which run the main loop, so we can't /// use the direct processing shortcut. static void SetForceRealTimer(); + + // Posting a dummy messages might be needed to ensure that main loop eventually returns from + // GetMessage ("wakes up") in modes without a visible window. This, e.g., might be needed to + // let main thread recheck a condition set from another thread. + static void PostDummyMessage(); }; #endif // _WIN32 diff --git a/vcl/source/app/winscheduler.cxx b/vcl/source/app/winscheduler.cxx index f8a90f3f638d..8ec11211cfe0 100644 --- a/vcl/source/app/winscheduler.cxx +++ b/vcl/source/app/winscheduler.cxx @@ -25,12 +25,18 @@ #include <win/saldata.hxx> #include <win/salinst.h> -void WinScheduler::SetForceRealTimer() +namespace { - BOOL const ret - = PostMessageW(GetSalData()->mpInstance->mhComWnd, SAL_MSG_FORCE_REAL_TIMER, 0, 0); +void PostMessageToComWnd(UINT nMsg) +{ + BOOL const ret = PostMessageW(GetSalData()->mpInstance->mhComWnd, nMsg, 0, 0); SAL_WARN_IF(0 == ret, "vcl.schedule", "ERROR: PostMessage() failed!"); } +} + +void WinScheduler::SetForceRealTimer() { PostMessageToComWnd(SAL_MSG_FORCE_REAL_TIMER); } + +void WinScheduler::PostDummyMessage() { PostMessageToComWnd(SAL_MSG_DUMMY); } #endif // _WIN32 |