[Libreoffice-commits] core.git: cui/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Jun 4 16:55:05 UTC 2018


 cui/source/options/personalization.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 766c85a4f67f5d50645340e31cebd5956998c6fc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 4 16:28:22 2018 +0200

    tdf#117866 cui: avoid deadlock in personalization dialog
    
    The deadlock happened as the main thread wanted to join
    SearchAndParseThread (while owning the solar mutex), but
    SearchAndParseThread wanted to take the solar mutex to import a graphic.
    
    Fix the deadlock by checking for the termination flag earlier, so we
    don't take any new mutexes if termination was requested already.
    
    Change-Id: Idddaadadc693610d9f31a14300b22aff8d452756
    Reviewed-on: https://gerrit.libreoffice.org/55284
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index a4ab78bed8a6..0eb20534931a 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -778,14 +778,16 @@ void SearchAndParseThread::execute()
                 continue;
             }
             INetURLObject aURLObj( sPreviewFile );
+
+            // Stop the thread if requested -- before taking the solar mutex.
+            if( !m_bExecute )
+                return;
+
             // for VCL to be able to create bitmaps / do visual changes in the thread
             SolarMutexGuard aGuard;
             aFilter.ImportGraphic( aGraphic, aURLObj );
             BitmapEx aBmp = aGraphic.GetBitmapEx();
 
-            if( !m_bExecute )
-                return;
-
             m_pPersonaDialog->SetImages( Image( aBmp ), nIndex++ );
             m_pPersonaDialog->setOptimalLayoutSize();
             m_pPersonaDialog->AddPersonaSetting( aPersonaSetting );


More information about the Libreoffice-commits mailing list