extensions/source/update/check/updatecheckjob.cxx | 4 ++++ 1 file changed, 4 insertions(+)
New commits: commit 73e062be1ff10e2dd889d9ec9c2d07b692077f62 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Dec 15 19:28:12 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Dec 16 06:34:35 2022 +0000 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.gran...@collabora.co.uk> 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();