From 68c503bc2ea99d49b305818da075c1aae3a4a91a Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 8 Apr 2020 21:27:27 +0200 Subject: [PATCH] Enabling an already enabled timer has no effect anymore. [INTERPRETER] * BUG: Enabling an already enabled timer has no effect anymore. --- main/gbx/gbx_c_timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/gbx/gbx_c_timer.c b/main/gbx/gbx_c_timer.c index 2b2c19b3b..2623f9f09 100644 --- a/main/gbx/gbx_c_timer.c +++ b/main/gbx/gbx_c_timer.c @@ -41,6 +41,7 @@ static void enable_timer(CTIMER *_object, bool on) { if (on != (THIS->id != 0)) HOOK_DEFAULT(timer, WATCH_timer)((GB_TIMER *)THIS, on); + if (on && (THIS->id == 0)) GB_Error("Too many active timers"); } @@ -128,7 +129,7 @@ BEGIN_PROPERTY(Timer_Enabled) if (READ_PROPERTY) GB_ReturnBoolean(THIS->id != 0); else - enable_timer(THIS, VPROP(GB_BOOLEAN)); + enable_timer(THIS, !!VPROP(GB_BOOLEAN)); END_PROPERTY