diff options
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/personalization.cxx | 14 | ||||
-rw-r--r-- | cui/source/options/personalization.hxx | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index a9ff29edf078..dab788d8b824 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -99,7 +99,13 @@ SelectPersonaDialog::~SelectPersonaDialog() void SelectPersonaDialog::dispose() { if (m_pSearchThread.is()) + { + // Release the solar mutex, so the thread is not affected by the race + // when it's after the m_bExecute check but before taking the solar + // mutex. + SolarMutexReleaser aReleaser; m_pSearchThread->join(); + } m_pEdit.clear(); m_pSearchButton.clear(); @@ -772,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 ); Bitmap aBmp = aGraphic.GetBitmap(); - if( !m_bExecute ) - return; - m_pPersonaDialog->SetImages( Image( aBmp ), nIndex++ ); m_pPersonaDialog->setOptimalLayoutSize(); m_pPersonaDialog->AddPersonaSetting( aPersonaSetting ); diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index 9d5e057c8c34..5153fc98b1b5 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -16,6 +16,7 @@ #include <vcl/prgsbar.hxx> #include <vector> #include <array> +#include <atomic> #define CATEGORYCOUNT 6 // Number of persona categories @@ -119,7 +120,8 @@ private: VclPtr<SelectPersonaDialog> m_pPersonaDialog; OUString m_aURL; - bool m_bExecute, m_bDirectURL; + std::atomic<bool> m_bExecute; + bool m_bDirectURL; virtual ~SearchAndParseThread() override; virtual void execute() override; |