mirror of https://github.com/stella-emu/stella.git
Fix race condition with use-after-free in TimerManager.
This commit is contained in:
parent
93fd9a2e2b
commit
e7c72a3532
|
@ -179,8 +179,11 @@ void TimerManager::timerThreadWorker()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Wait until the timer is ready or a timer creation notifies
|
// Wait until the timer is ready or a timer creation notifies. Note that wait until accesses
|
||||||
wakeUp.wait_until(lock, timer.next);
|
// time_point by reference, so we make a copy in case the current time is deleted while the
|
||||||
|
// thread sleeps.
|
||||||
|
const auto next = timer.next;
|
||||||
|
wakeUp.wait_until(lock, next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue