summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-06-04 16:28:22 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-06-04 18:54:43 +0200
commit766c85a4f67f5d50645340e31cebd5956998c6fc (patch)
treecab3c8589d122f65bf8409e44252d3691b92a41e
parent710ba43421067528004321591d78e0f386da1ab0 (diff)
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@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--cui/source/options/personalization.cxx8
1 files changed, 5 insertions, 3 deletions
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 );