fix: Fixes timers detaching if they are stopped/started in OnTick (#1906)
This commit is contained in:
parent
6a476e6254
commit
2c9b3ef112
1 changed files with 3 additions and 3 deletions
|
|
@ -139,14 +139,15 @@ public partial class Timer
|
||||||
var prof = timer.GetProfile();
|
var prof = timer.GetProfile();
|
||||||
prof?.Start();
|
prof?.Start();
|
||||||
|
|
||||||
|
var version = timer.Version;
|
||||||
|
|
||||||
// Stop the timer from running so that way if Start() is called in OnTick, the timer will be started.
|
// Stop the timer from running so that way if Start() is called in OnTick, the timer will be started.
|
||||||
if (finished)
|
if (finished)
|
||||||
{
|
{
|
||||||
timer.InternalStop();
|
timer.InternalStop();
|
||||||
|
timer.Version++;
|
||||||
}
|
}
|
||||||
|
|
||||||
var version = timer.Version;
|
|
||||||
|
|
||||||
timer.OnTick();
|
timer.OnTick();
|
||||||
prof?.Finish();
|
prof?.Finish();
|
||||||
|
|
||||||
|
|
@ -160,7 +161,6 @@ public partial class Timer
|
||||||
{
|
{
|
||||||
// Already stopped and detached, now run OnDetach
|
// Already stopped and detached, now run OnDetach
|
||||||
timer.OnDetach();
|
timer.OnDetach();
|
||||||
timer.Version++;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue