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:
parent
43371ada1a
commit
1dae941600
1 changed files with 6 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue