fix: Fixes timers not stopping before OnTick (#1890)

This commit is contained in:
Kamron Batman 2024-07-28 14:35:41 -07:00 • committed by GitHub
parent 4610712205
commit 2d9872b53a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 39 deletions

View file

@ -153,21 +153,7 @@ public partial class Timer
Running = false;
// We are the head on the timer ring
if (_rings[_ring][_slot] == this)
{
_rings[_ring][_slot] = _nextTimer;
}
// We are the head on the executing ring
if (_executingRings[_ring] == this)
{
_executingRings[_ring] = _nextTimer;
}
Detach();
Version++;
OnDetach();
var prof = GetProfile();
@ -175,6 +161,7 @@ public partial class Timer
{
prof.Stopped++;
}
Version++;
}
protected virtual void OnTick()
@ -213,6 +200,18 @@ public partial class Timer
private void Detach()
{
// We are the head on the timer ring
if (_rings[_ring][_slot] == this)
{
_rings[_ring][_slot] = _nextTimer;
}
// We are the head on the executing ring
if (_executingRings[_ring] == this)
{
_executingRings[_ring] = _nextTimer;
}
if (_prevTimer != null)
{
_prevTimer._nextTimer = _nextTimer;