From 586a42343b0ea77b09b1c572ab36d293f8713bd8 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sun, 14 Nov 2021 01:22:07 +0700 Subject: [PATCH] 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. --- sources/Time/Timer.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/Time/Timer.uc b/sources/Time/Timer.uc index 844b3e6..6a3e730 100644 --- a/sources/Time/Timer.uc +++ b/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;