Skip to content

Commit

Permalink
Default timer copy constructor causing weird issues
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mikee47 committed Jan 8, 2024
1 parent aa925a5 commit 126739b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Sming/Core/CallbackTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ template <typename ApiDef> struct CallbackTimerApi {
return ApiDef::typeName();
}

CallbackTimerApi()
{
}

CallbackTimerApi(const CallbackTimerApi&) = delete;

String name() const
{
String s;
Expand All @@ -50,7 +56,6 @@ template <typename ApiDef> struct CallbackTimerApi {
s += static_cast<const ApiDef*>(this)->getInterval();
s += ", ticks = ";
s += static_cast<const ApiDef*>(this)->ticks();
// s += ApiDef::Clock::ticks();
return s;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/HostTests/modules/Timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ";
Expand Down

0 comments on commit 126739b

Please sign in to comment.