diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-12-15 13:39:32 +0100 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2017-12-21 09:18:01 +0100 |
commit | 5469ac13b13e458904900539e6542d4a83d44c4e (patch) | |
tree | 0d90f71b83162c9a0709c156397d5d3a3847a2ed /vcl/inc/salusereventlist.hxx | |
parent | 71cd37fad9792038279969c82e0cb209df06f024 (diff) |
Prevent out-of-order LO event processing
There's a callback processing loop, introduced by
a7c84375db517769035080c8fed33b2f303fc42f, which releases the
SolarMutex and is triggered by a queued user event. Such a
scenario can easily be reproduced by any LOK client resulting in
hitting the empty user event processing list assertion.
I'm not sure this should be handled via LO events at all.
So this - again - gets rid of the the assertion and tries to
prevent processing the user events out-of-order.
In the case of giving up the SolarMutex while processing a user
event an other thread or even nested loop can "steal" the user
event list and continue processing.
Most VCL backends run the event loop just in the main process,
so for them this scenario is guaranteed. But the headless
backend - running without UI or from LOK - is still allowed to
process events in any thread. This is harder to fix and probably
should use the same solution the gtk* backends use.
This also changes the dequeues into lists to use splice for
appending them.
Change-Id: Id4a93a01dea415271ad96098830f18f06d4a75b9
Reviewed-on: https://gerrit.libreoffice.org/46550
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'vcl/inc/salusereventlist.hxx')
-rw-r--r-- | vcl/inc/salusereventlist.hxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/vcl/inc/salusereventlist.hxx b/vcl/inc/salusereventlist.hxx index 123b9dadd1c7..52a195a68f82 100644 --- a/vcl/inc/salusereventlist.hxx +++ b/vcl/inc/salusereventlist.hxx @@ -23,10 +23,11 @@ #include <sal/config.h> #include <vcl/dllapi.h> #include <osl/mutex.hxx> +#include <osl/thread.hxx> #include <assert.h> -#include <deque> +#include <list> #include <unordered_set> class SalFrame; @@ -65,10 +66,11 @@ public: protected: mutable osl::Mutex m_aUserEventsMutex; - std::deque< SalUserEvent > m_aUserEvents; - std::deque< SalUserEvent > m_aProcessingUserEvents; + std::list< SalUserEvent > m_aUserEvents; + std::list< SalUserEvent > m_aProcessingUserEvents; bool m_bAllUserEventProcessedSignaled; SalFrameSet m_aFrames; + oslThreadIdentifier m_aProcessingThread; virtual void ProcessEvent( SalUserEvent aEvent ) = 0; virtual void TriggerUserEventProcessing() = 0; |