1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Timer: Add assertion to warn when destroying a timer from a background thread

This commit is contained in:
reuk 2020-10-19 19:54:21 +01:00
parent 43371ada1a
commit 1dae941600

View file

@ -317,6 +317,12 @@ Timer::Timer (const Timer&) noexcept {}
Timer::~Timer()
{
// If you're destroying a timer on a background thread, make sure the timer has
// been stopped before execution reaches this point. A simple way to achieve this
// is to add a call to `stopTimer()` to the destructor of your class which inherits
// from Timer.
jassert (MessageManager::existsAndIsCurrentThread() || ! isTimerRunning());
stopTimer();
}