Browse Source

Fix performing code inside deallocated `Timer`

`Timer` could have been deallocated after it has emitted its signal, but
still try to execute code and change its internal state. This patch
prevents that.
pull/8/head
Anton Tarasenko 3 years ago
parent
commit
586a42343b
  1. 2
      sources/Time/Timer.uc

2
sources/Time/Timer.uc

@ -235,7 +235,7 @@ private final function Tick(float delta, float dilationCoefficient)
// is reset there and already has a zeroed `totalElapsedTime`
totalElapsedTime -= eventInterval;
onElapsedSignal.Emit(self);
if (!isTimerAutoReset)
if (!isTimerAutoReset && IsAllocated())
{
StopMe();
return;

Loading…
Cancel
Save