From 126739b258720562cfa9ae55738474102890f775 Mon Sep 17 00:00:00 2001 From: mikee47 Date: Sun, 7 Jan 2024 16:05:11 +0000 Subject: [PATCH] Default timer copy constructor causing weird issues e.g. ``` String s; s += timer; ``` Doesn't behave as expected and instead constructs new instance then calls destructor on it. Manifests by hanging HostTests on esp32 (standard, s2 and c3 variants) but curiously not on esp8266 or host. --- Sming/Core/CallbackTimer.h | 7 ++++++- tests/HostTests/modules/Timers.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Sming/Core/CallbackTimer.h b/Sming/Core/CallbackTimer.h index 9844c6ed86..f56ef2dc58 100644 --- a/Sming/Core/CallbackTimer.h +++ b/Sming/Core/CallbackTimer.h @@ -33,6 +33,12 @@ template struct CallbackTimerApi { return ApiDef::typeName(); } + CallbackTimerApi() + { + } + + CallbackTimerApi(const CallbackTimerApi&) = delete; + String name() const { String s; @@ -50,7 +56,6 @@ template struct CallbackTimerApi { s += static_cast(this)->getInterval(); s += ", ticks = "; s += static_cast(this)->ticks(); - // s += ApiDef::Clock::ticks(); return s; } diff --git a/tests/HostTests/modules/Timers.cpp b/tests/HostTests/modules/Timers.cpp index 5e0eda4fba..2dc7bb638c 100644 --- a/tests/HostTests/modules/Timers.cpp +++ b/tests/HostTests/modules/Timers.cpp @@ -81,7 +81,7 @@ class CallbackTimerTest : public TestGroup String s; s += system_get_time(); s += " "; - s += statusTimer; + s += String(statusTimer); s += " fired, timercount = "; s += activeTimerCount; s += ", mem = ";