summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-12-15 19:28:12 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-12-19 09:06:37 +0000
commit2bd1c84e8cd455bdae7ba8d160bf5805de3fa0be (patch)
treeebe8c6c03080aed4f15b68f36bec625a5b18325c
parent27a9519ca9434c534ef2b84e75057b505d056383 (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> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144347
-rw-r--r--extensions/source/update/check/updatecheckjob.cxx4
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();