fix: Fixes timers not stopping before OnTick (#1890)
This commit is contained in:
parent
4610712205
commit
2d9872b53a
4 changed files with 68 additions and 39 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue