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();
|
||||
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.
|
||||
if (finished)
|
||||
{
|
||||
timer.InternalStop();
|
||||
timer.Version++;
|
||||
}
|
||||
|
||||
var version = timer.Version;
|
||||
|
||||
timer.OnTick();
|
||||
prof?.Finish();
|
||||
|
||||
|
|
@ -160,7 +161,6 @@ public partial class Timer
|
|||
{
|
||||
// Already stopped and detached, now run OnDetach
|
||||
timer.OnDetach();
|
||||
timer.Version++;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue