From 67138302543a4e64f897bdfe7bc996d099360c28 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Mon, 11 Aug 2014 00:31:18 +0200 Subject: [PATCH] Nasal Timer: prevent warning on restarting oneshot timer in callback. --- src/Scripting/NasalSys.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index f70aa3c61..75c49fbcf 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -146,11 +146,14 @@ public: void invoke() { + if( _singleShot ) + // Callback may restart the timer, so update status before callback is + // called (Prevent warnings of deleting not existing tasks from the + // event manager). + _isRunning = false; + naRef *args = NULL; _sys->callMethod(_func, _self, 0, args, naNil() /* locals */); - if (_singleShot) { - _isRunning = false; - } } void setSingleShot(bool aSingleShot) -- 2.39.5