diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-08-28 19:58:32 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-09-26 09:42:11 +0200 |
commit | 4baec725e0dc0713f0d47003e9b10bc3b62f56ff (patch) | |
tree | 72f21c28416068e46133964e420ca094af8b7587 /vcl/source/app/svapp.cxx | |
parent | f633dcdfc0ad7a13d096d97b6753b55e8f8a3f07 (diff) |
WIN run main thread redirects ignoring SolarMutex
This way we can drop all the special nReleased handling. Instead
we use the same mechanism as on Mac, where we keep the lock, but
disable it for the main thread. As a security measure we assert on
duplicate redirects, which should not happen.
As a result we can't use SendMessage on the main thread itself,
which would normally just call the WinProc directly. This could be
accomplished by converting the redirect bool into a counter, which
should be safe, as no other thread could acquire the SolarMutex,
as we don't release it.
Change-Id: Icd87b3da37a2489f3cad2bc80215bf93fc41d388
Reviewed-on: https://gerrit.libreoffice.org/42583
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/source/app/svapp.cxx')
-rw-r--r-- | vcl/source/app/svapp.cxx | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 3107e88d3c91..612fce86bc2f 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -451,12 +451,12 @@ void Application::Execute() pSVData->maAppData.mbInAppExecute = false; } -inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased) +inline bool ImplYield(bool i_bWait, bool i_bAllEvents) { ImplSVData* pSVData = ImplGetSVData(); SAL_INFO("vcl.schedule", "Enter ImplYield: " << (i_bWait ? "wait" : "no wait") << - ": " << (i_bAllEvents ? "all events" : "one event") << ": " << nReleased); + ": " << (i_bAllEvents ? "all events" : "one event")); // TODO: there's a data race here on WNT only because ImplYield may be // called without SolarMutex; if we can get rid of LazyDelete (with VclPtr) @@ -466,10 +466,8 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased // do not wait for events if application was already quit; in that // case only dispatch events already available - bool bProcessedEvent = - pSVData->mpDefInst->DoYield( - i_bWait && !pSVData->maAppData.mbAppQuit, - i_bAllEvents, nReleased); + bool bProcessedEvent = pSVData->mpDefInst->DoYield( + i_bWait && !pSVData->maAppData.mbAppQuit, i_bAllEvents ); pSVData->maAppData.mnDispatchLevel--; @@ -485,7 +483,7 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased bool Application::Reschedule( bool i_bAllEvents ) { - return ImplYield(false, i_bAllEvents, 0); + return ImplYield(false, i_bAllEvents); } void Scheduler::ProcessEventsToSignal(bool& bSignal) @@ -537,27 +535,7 @@ SAL_DLLPUBLIC_EXPORT void unit_lok_process_events_to_idle() void Application::Yield() { - ImplYield(true, false, 0); -} - -void Application::ReAcquireSolarMutex(sal_uLong const nReleased) -{ - // 0 would mean that events/timers will be handled without locking - // SolarMutex (racy) - SAL_WARN_IF(nReleased == 0, "vcl", "SolarMutexReleaser without SolarMutex"); -#ifdef _WIN32 - if (nReleased == 0 || ImplGetSVData()->mbDeInit) //do not Yield in DeInitVCL - AcquireSolarMutex(nReleased); - else - ImplYield(false, false, nReleased); -#else - // a) Yield is not needed on non-WNT platforms - // b) some Yield implementations for X11 (e.g. kde4) make it non-obvious - // how to use nReleased - // c) would require a review of what all Yield implementations do - // currently _before_ releasing SolarMutex that would run without lock - AcquireSolarMutex(nReleased); -#endif + ImplYield(true, false); } IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplQuitMsg, void*, void ) |