[Libreoffice-commits] core.git: vcl/unx

Luboš Luňák l.lunak at collabora.com
Tue Apr 29 04:08:48 PDT 2014


 vcl/unx/kde4/KDEXLib.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit f09d4bc2853be2fa3faa0502b8efe94ad9719731
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Tue Apr 29 13:06:58 2014 +0200

    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

diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index faa1ff1..2630c0c 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 );
     }
 }


More information about the Libreoffice-commits mailing list