diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-12-15 19:28:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-12-16 06:34:35 +0000 |
commit | 73e062be1ff10e2dd889d9ec9c2d07b692077f62 (patch) | |
tree | f6b90054c71197e283c4da173944e25fdde77e79 /extensions | |
parent | 718af940435ae9d2ac90374e5880ecb38e96252c (diff) |
blind fix for some 7.4.3.2 crashes in UpdateCheckJob
I am guessing that state in this object is being touched from
multiple threads (since it is an UNO service object), and one or
more of the threads are consequently seeing inconsistent state.
Change-Id: Ib925740d3b8db2713c4f132d0367b794a412a269
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144248
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/update/check/updatecheckjob.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx index 7fabb98bff4c..bf30c1686842 100644 --- a/extensions/source/update/check/updatecheckjob.cxx +++ b/extensions/source/update/check/updatecheckjob.cxx @@ -96,6 +96,7 @@ public: virtual void SAL_CALL notifyTermination( lang::EventObject const & evt ) override; private: + std::mutex m_mutex; uno::Reference<uno::XComponentContext> m_xContext; uno::Reference< frame::XDesktop2 > m_xDesktop; std::unique_ptr< InitUpdateCheckJobThread > m_pInitThread; @@ -174,6 +175,7 @@ UpdateCheckJob::~UpdateCheckJob() uno::Any UpdateCheckJob::execute(const uno::Sequence<beans::NamedValue>& namedValues) { + std::scoped_lock l(m_mutex); for ( sal_Int32 n=namedValues.getLength(); n-- > 0; ) { if ( namedValues[ n ].Name == "DynamicData" ) @@ -274,6 +276,7 @@ UpdateCheckJob::supportsService( OUString const & serviceName ) // XEventListener void SAL_CALL UpdateCheckJob::disposing( lang::EventObject const & rEvt ) { + std::scoped_lock l(m_mutex); bool shutDown = ( rEvt.Source == m_xDesktop ); if ( shutDown && m_xDesktop.is() ) @@ -292,6 +295,7 @@ void SAL_CALL UpdateCheckJob::queryTermination( lang::EventObject const & ) void UpdateCheckJob::terminateAndJoinThread() { + std::scoped_lock l(m_mutex); if (m_pInitThread != nullptr) { m_pInitThread->setTerminating(); |