diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-04-29 13:06:58 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-04-29 13:08:13 +0200 |
commit | f09d4bc2853be2fa3faa0502b8efe94ad9719731 (patch) | |
tree | afb79a51e035839300c1a41d3b942ad2ad9ff467 /vcl/unx/kde4 | |
parent | ea391abb3f2eb0ffaa892f9d7437dcf33bda6440 (diff) |
prevent deadlocks between main thread and other thread processing a Qt event
This part of 13a34f4c6307d1bd2443cbf3fbd83bfdd8cdbafb was correct. The main
thread will deadlock on the yield mutex if the calling thread does not release
it before waiting on the main thread.
Change-Id: I6692473457258b791c131e8bdb459b06b01550f7
Diffstat (limited to 'vcl/unx/kde4')
-rw-r--r-- | vcl/unx/kde4/KDEXLib.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index faa1ff1a278d..2630c0c51781 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -297,8 +297,12 @@ void KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( qApp->thread() == QThread::currentThread()) processYield( bWait, bHandleAllCurrentEvents ); else - { // if this deadlocks, event processing needs to go into a separate thread - // or some other solution needs to be found + { + // we were called from another thread; + // release the yield lock to prevent deadlock with the main thread + // (it's ok to release it here, since even normal processYield() would + // temporarily do it while checking for new events) + SalYieldMutexReleaser aReleaser; Q_EMIT processYieldSignal( bWait, bHandleAllCurrentEvents ); } } |