diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 66f663d68fb4..42f0ce3cd342 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -675,9 +675,12 @@ void SearchAndParseThread::execute() { if( m_aURL.startsWith( "https://" ) ) { - m_pPersonaDialog->ClearSearchResults(); - OUString sProgress( CuiResId( RID_SVXSTR_SEARCHING ) ), sError; - m_pPersonaDialog->SetProgress( sProgress ); + { + SolarMutexGuard aGuard + m_pPersonaDialog->ClearSearchResults(); + OUString sProgress( CuiResId( RID_SVXSTR_SEARCHING ) ), sError; + m_pPersonaDialog->SetProgress( sProgress ); + } PersonasDocHandler* pHandler = new PersonasDocHandler(); Reference xContext( ::comphelper::getProcessComponentContext() ); @@ -701,6 +704,7 @@ void SearchAndParseThread::execute() xStream = xFileAccess->openFileRead( m_aURL ); if( !xStream.is() ) { + SolarMutexGuard aGuard; // in case of a returned CommandFailedException // SimpleFileAccess serves it, returning an empty stream sError = CuiResId(RID_SVXSTR_SEARCHERROR); @@ -713,6 +717,7 @@ void SearchAndParseThread::execute() } catch (...) { + SolarMutexGuard aGuard; // a catch all clause, in case the exception is not // served elsewhere sError = CuiResId(RID_SVXSTR_SEARCHERROR); @@ -729,6 +734,7 @@ void SearchAndParseThread::execute() if( !pHandler->hasResults() ) { + SolarMutexGuard aGuard; sProgress = CuiResId( RID_SVXSTR_NORESULTS ); m_pPersonaDialog->SetProgress( sProgress ); return; @@ -755,6 +761,7 @@ void SearchAndParseThread::execute() { if( m_bDirectURL ) { + SolarMutexGuard aGuard; sError = CuiResId(RID_SVXSTR_SEARCHERROR); sError = sError.replaceAll("%1", m_aURL); m_pPersonaDialog->SetProgress( OUString() ); @@ -764,15 +771,18 @@ void SearchAndParseThread::execute() } continue; } + + // before using VCL graphic code we need to hold the SolarMutex + SolarMutexGuard aGuard; + INetURLObject aURLObj( sPreviewFile ); + // FIXME: when we have thread-safe graphic de-compression fix. aFilter.ImportGraphic( aGraphic, aURLObj ); Bitmap aBmp = aGraphic.GetBitmap(); if( !m_bExecute ) return; - // for VCL to be able to do visual changes in the thread - SolarMutexGuard aGuard; m_pPersonaDialog->SetImages( Image( aBmp ), nIndex++ ); m_pPersonaDialog->setOptimalLayoutSize(); m_pPersonaDialog->AddPersonaSetting( aPersonaSetting );