cid#1557258 Data race condition
Change-Id: Iaf4fdba3696669763511aa476e53a0fea36a05c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177589 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
parent
fb30ee5a63
commit
6fd05636e2
1 changed files with 6 additions and 5 deletions
|
@ -260,12 +260,15 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId)
|
||||||
|
|
||||||
void TimerScheduler::NotifyTermination()
|
void TimerScheduler::NotifyTermination()
|
||||||
{
|
{
|
||||||
std::shared_ptr<TimerScheduler> const pInstance(TimerScheduler::mpInstance);
|
std::shared_ptr<TimerScheduler> pInstance;
|
||||||
if (!pInstance)
|
|
||||||
{
|
{
|
||||||
return;
|
std::scoped_lock aGuard (maInstanceMutex);
|
||||||
|
pInstance = TimerScheduler::mpInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pInstance)
|
||||||
|
return;
|
||||||
|
|
||||||
{
|
{
|
||||||
std::scoped_lock aGuard(pInstance->maTaskContainerMutex);
|
std::scoped_lock aGuard(pInstance->maTaskContainerMutex);
|
||||||
pInstance->maScheduledTasks.clear();
|
pInstance->maScheduledTasks.clear();
|
||||||
|
@ -274,10 +277,8 @@ void TimerScheduler::NotifyTermination()
|
||||||
{
|
{
|
||||||
std::scoped_lock aGuard(pInstance->maCurrentTaskMutex);
|
std::scoped_lock aGuard(pInstance->maCurrentTaskMutex);
|
||||||
if (pInstance->mpCurrentTask)
|
if (pInstance->mpCurrentTask)
|
||||||
{
|
|
||||||
pInstance->mpCurrentTask->mbIsCanceled = true;
|
pInstance->mpCurrentTask->mbIsCanceled = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pInstance->m_Shutdown.set();
|
pInstance->m_Shutdown.set();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue