[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - vcl/unx

Jan-Marek Glogowski glogow at fbihome.de
Thu Dec 12 04:00:23 PST 2013


 vcl/unx/kde4/KDESalDisplay.cxx |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 8b4775458600dc2a2e8eb17e0bade35221c6b2ea
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Thu Nov 21 12:40:57 2013 +0100

    fdo#67011: Run Display::Yield through KDEXLib::Yield.
    
    Drag'n'Drop is handled in a second thread, which tries to "yield
    the display" while the main Qt thread probably is already
    yielding. Both need the YieldMutex, which freezes the application
    until the D'n'D thread times out.
    
    Trying to yield the display throught the application yield
    results in a recursive loop.
    
    So this catches and breaks the recursion, but just inside the Qt
    thread, so other processes can "yield on the display", instead
    of simply disabling the Display::Yield.
    
    Change-Id: Ifba91aa89fe5b0a89cc94820935dc996a065112f
    Reviewed-on: https://gerrit.libreoffice.org/6750
    Tested-by: Jan-Marek Glogowski <glogow at fbihome.de>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx
index 21440fc..ee330e7 100644
--- a/vcl/unx/kde4/KDESalDisplay.cxx
+++ b/vcl/unx/kde4/KDESalDisplay.cxx
@@ -25,6 +25,8 @@
 #include <assert.h>
 #include <unx/saldata.hxx>
 
+#include <qthread.h>
+
 SalKDEDisplay* SalKDEDisplay::selfptr = NULL;
 
 SalKDEDisplay::SalKDEDisplay( Display* pDisp )
@@ -48,18 +50,26 @@ SalKDEDisplay::~SalKDEDisplay()
 
 void SalKDEDisplay::Yield()
 {
-    if( DispatchInternalEvent() )
+    // We yield the display throught the main Qt thread.
+    // Actually this Yield may call the Display::Yield, which results in an
+    // unlimited cycle.
+    static bool break_cyclic_yield_recursion = false;
+    bool is_qt_gui_thread = ( qApp->thread() == QThread::currentThread() );
+
+    if( DispatchInternalEvent() || break_cyclic_yield_recursion )
         return;
 
+    if( is_qt_gui_thread )
+        break_cyclic_yield_recursion = true;
+
     DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() ==
                 osl::Thread::getCurrentIdentifier(),
                 "will crash soon since solar mutex not locked in SalKDEDisplay::Yield" );
 
-    XEvent event;
-    XNextEvent( pDisp_, &event );
-    if( checkDirectInputEvent( &event ))
-        return;
-    qApp->x11ProcessEvent( &event );
+    static_cast<KDEXLib*>(GetXLib())->Yield( true, false );
+
+    if( is_qt_gui_thread )
+        break_cyclic_yield_recursion = false;
 }
 
 // HACK: When using Qt event loop, input methods (japanese, etc.) will get broken because


More information about the Libreoffice-commits mailing list