From 6fd05636e2b14806355c2a612de5755f1f6b801d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 29 Nov 2024 21:45:48 +0000 Subject: [PATCH] cid#1557258 Data race condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iaf4fdba3696669763511aa476e53a0fea36a05c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177589 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sd/source/console/PresenterTimer.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sd/source/console/PresenterTimer.cxx b/sd/source/console/PresenterTimer.cxx index cffb2dc738fc..d48c0d608bb3 100644 --- a/sd/source/console/PresenterTimer.cxx +++ b/sd/source/console/PresenterTimer.cxx @@ -260,12 +260,15 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId) void TimerScheduler::NotifyTermination() { - std::shared_ptr const pInstance(TimerScheduler::mpInstance); - if (!pInstance) + std::shared_ptr pInstance; { - return; + std::scoped_lock aGuard (maInstanceMutex); + pInstance = TimerScheduler::mpInstance; } + if (!pInstance) + return; + { std::scoped_lock aGuard(pInstance->maTaskContainerMutex); pInstance->maScheduledTasks.clear(); @@ -274,9 +277,7 @@ void TimerScheduler::NotifyTermination() { std::scoped_lock aGuard(pInstance->maCurrentTaskMutex); if (pInstance->mpCurrentTask) - { pInstance->mpCurrentTask->mbIsCanceled = true; - } } pInstance->m_Shutdown.set();