The problem does not always happen, so its difficult to see whats going on with a breakpoint. So i added some logging statements, to the thread and timer Class in this form.
#if JUCE_DEBUG
String s("\nThread::waitForThreadToExit");
s+=T(" Name:")+getThreadName();
s+=T(" ID:")+String().toHexString(getThreadId());
DBG(s);
#endif
#if JUCE_DEBUG
String s("\nTimer destructor start "+String((int64)this));
s+=T(" countdownMs=")+String(countdownMs);
s+=T(" isTimerRunning=")+String(isTimerRunning());
s+=T(" next=")+String((int64)next);
s+=T(" periodMs=")+String(periodMs);
s+=T(" previous=")+String((int64)previous);
DBG(s);
#endif
I’m not sure if it helps to find the problem.
You see there are some memory-leaks, can this be the problem (maybe from the message-queue)?
I use my own “lookandfeel” but the problem appears without using this lookandfeel too.
[size=150]The output when thread is closing correct, 0xed8 is the timer[/size]
…
…
…
‘Cubasesx3.exe’: Loaded ‘C:\WINDOWS\system32\msvcr71.dll’, No symbols loaded.
‘Cubasesx3.exe’: Loaded ‘C:\WINDOWS\system32\msvcp71.dll’, No symbols loaded.
‘Cubasesx3.exe’: Loaded ‘C:\Programme\Steinberg\Cubase SX 3\Vstplugins\develop\my_lib_test_plugin_debug.dll’, Symbols loaded.
JUCE v1.41
Thread::Thread Name:Juce Timer ID:0
Thread::notify() Name:Juce Timer ID:0
Timer destructor start 83321332 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 83321332 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor start 83324020 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 83324020 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::notify() Name:Juce Timer ID:0
Timer destructor start 315100560 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 315100560 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor start 315099376 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 315099376 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::notify() Name:Juce Timer ID:0
Thread::startThread() Name:Juce Timer ID:0
Thread::startThread(const int priority) Name:Juce Timer ID:0
Thread::wait Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
‘Cubasesx3.exe’: Loaded ‘C:\WINDOWS\system32\mscms.dll’, No symbols loaded.
‘Cubasesx3.exe’: Loaded ‘C:\WINDOWS\system32\icm32.dll’, No symbols loaded.
Thread::notify() Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
Thread::notify() Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
etc…
Timer destructor start 315078632 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 315078632 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::wait Name:Juce Timer ID:ed8
Timer destructor start 315077768 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 315077768 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::notify() Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
Timer destructor start 315115628 countdownMs=2805 isTimerRunning=1 next=0 periodMs=3000 previous=83333140
Timer destructor end 315115628 countdownMs=2805 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::wait Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
Thread::wait Name:Juce Timer ID:ed8
etc…
Timer destructor start 83328424 countdownMs=-1 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 83328424 countdownMs=-1 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::wait Name:Juce Timer ID:ed8
Timer destructor start 83333140 countdownMs=999 isTimerRunning=1 next=0 periodMs=999 previous=0
Timer destructor end 83333140 countdownMs=999 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor start 83318588 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 83318588 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::isThreadRunning() Name:Juce Timer ID:ed8
Thread::signalThreadShouldExit() Name:Juce Timer ID:ed8
Thread::notify() Name:Juce Timer ID:ed8
Thread::isThreadRunning() Name:Juce Timer ID:0
Thread::threadEntryPoint Name:Juce Timer ID:0
Thread::waitForThreadToExit Name:Juce Timer ID:0
Thread::isThreadRunning() Name:Juce Timer ID:0
Thread::stopThread Name:Juce Timer ID:0
Thread::isThreadRunning() Name:Juce Timer ID:0
Thread::stopThread Name:Juce Timer ID:0
Thread::~Thread() Name:Juce Timer ID:0
Timer destructor start 83314428 countdownMs=250 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 83314428 countdownMs=250 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::stopAllThreads
Thread::getNumRunningThreads()
Detected memory leaks!
Dumping objects ->
c:\cpp_projects\juce\src\juce_appframework\events\juce_message.h(81) : {321656} normal block at 0x14FCA8C8, 24 bytes long.
Data: < > FC 96 BA 0C CD CD CD CD CD CD CD CD CD CD CD CD
c:\cpp_projects\juce\src\juce_appframework\events\juce_message.h(81) : {307229} normal block at 0x12C88648, 24 bytes long.
Data: < > FC 96 BA 0C 00 00 00 00 00 00 00 00 00 00 00 00
c:\cpp_projects\juce\src\juce_core\containers\juce_arrayallocationbase.h(96) : {89015} normal block at 0x10826D60, 320 bytes long.
Data: < e > 00 01 00 01 01 01 00 01 02 01 00 01 01 65 00 01
c:\cpp_projects\juce\src\juce_core\containers\juce_arrayallocationbase.h(96) : {89016} normal block at 0x10826F60, 320 bytes long.
Data: < DD > FF BB BB FF FF 44 44 FF 00 00 00 FF 00 00 00 FF
c:\cpp_projects\juce\src\juce_appframework\gui\components\lookandfeel\mylookandfeel.h(194) : {88976} normal block at 0x12C87508, 64 bytes long.
Data: <4l > 34 6C BA 0C C0 BA BA 0C 00 00 00 00 00 00 00 00
Object dump complete.
Detected memory leaks!
Dumping objects ->
c:\cpp_projects\juce\src\juce_appframework\events\juce_message.h(81) : {321656} normal block at 0x14FCA8C8, 24 bytes long.
Data: < > FC 96 BA 0C CD CD CD CD CD CD CD CD CD CD CD CD
c:\cpp_projects\juce\src\juce_appframework\events\juce_message.h(81) : {307229} normal block at 0x12C88648, 24 bytes long.
Data: < > FC 96 BA 0C 00 00 00 00 00 00 00 00 00 00 00 00
c:\cpp_projects\juce\src\juce_core\containers\juce_arrayallocationbase.h(96) : {89015} normal block at 0x10826D60, 320 bytes long.
Data: < e > 00 01 00 01 01 01 00 01 02 01 00 01 01 65 00 01
c:\cpp_projects\juce\src\juce_core\containers\juce_arrayallocationbase.h(96) : {89016} normal block at 0x10826F60, 320 bytes long.
Data: < DD > FF BB BB FF FF 44 44 FF 00 00 00 FF 00 00 00 FF
c:\cpp_projects\juce\src\juce_appframework\gui\components\lookandfeel\mylookandfeel.h(194) : {88976} normal block at 0x12C87508, 64 bytes long.
Data: <4l > 34 6C BA 0C C0 BA BA 0C 00 00 00 00 00 00 00 00
Object dump complete.
‘Cubasesx3.exe’: Unloaded 'C:\Programme\Steinberg\Cubase SX 3\Vstplugins\develop\my_lib_test_plugin_debug.dll’
The thread ‘Juce Timer’ (0xed8) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xfc8) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0x958) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xeb8) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xd4) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xcb8) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xe34) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xaa4) has exited with code 0 (0x0).
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\msvcp71.dll’
‘Cubasesx3.exe’: Unloaded 'C:\WINDOWS\system32\msvcr71.dll’
The thread ‘Win32 Thread’ (0x9bc) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0x8f8) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xaf0) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0x6e4) has exited with code 1324 (0x52c).
The thread ‘Win32 Thread’ (0xf2c) has exited with code 3366 (0xd26).
The thread ‘Win32 Thread’ (0x9a0) has exited with code 39321 (0x9999).
The thread ‘Win32 Thread’ (0x524) has exited with code 1 (0x1).
The thread ‘Win32 Thread’ (0x168) has exited with code 1 (0x1).
The thread ‘Win32 Thread’ (0xe54) has exited with code 44 (0x2c).
The thread ‘Win32 Thread’ (0xcd0) has exited with code 0 (0x0).
‘Cubasesx3.exe’: Unloaded 'C:\Programme\Steinberg\Cubase SX 3\TimeBandit.dll’
The thread ‘Win32 Thread’ (0xde4) has exited with code 0 (0x0).
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\ReWire.dll’
‘Cubasesx3.exe’: Unloaded ‘C:\Programme\Steinberg\Cubase SX 3\convif.opt’
‘Cubasesx3.exe’: Unloaded ‘C:\Programme\Steinberg\Cubase SX 3\audioprimitives.opt’
‘Cubasesx3.exe’: Unloaded ‘C:\Programme\Steinberg\Cubase SX 3\audiochannel.opt’
‘Cubasesx3.exe’: Unloaded ‘C:\Programme\Steinberg\Cubase SX 3\audiodsp.opt’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\fireface_asio.dll’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\cscui.dll’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\cscdll.dll’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\msimg32.dll’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\ksproxy.ax’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\ksuser.dll’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\devenum.dll’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\dmsynth.dll’
‘Cubasesx3.exe’: Unloaded ‘C:\WINDOWS\system32\dmusic.dll’
‘Cubasesx3.exe’: Unloaded 'C:\Programme\Steinberg\Cubase SX 3\Components\omffilter.dll’
The thread ‘Win32 Thread’ (0x1f4) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xa50) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xb80) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0x80c) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xd00) has exited with code 0 (0x0).
The program ‘[3468] Cubasesx3.exe: Native’ has exited with code 0 (0x0).
[size=150]
The output when it breaks, 0xe1c is the problematic timer[/size]
1000x
Thread::wait Name:Juce Timer ID:e1c
Thread::wait Name:Juce Timer ID:e1c
Thread::wait Name:Juce Timer ID:e1c
Thread::wait Name:Juce Timer ID:e1c
etc…
The thread ‘Win32 Thread’ (0xb8c) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xbcc) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0x478) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0x4c0) has exited with code 0 (0x0).
The thread ‘Win32 Thread’ (0xe14) has exited with code 0 (0x0).
Thread::wait Name:Juce Timer ID:e1c
The thread ‘Juce Timer’ (0xe1c) has exited with code 0 (0x0).
Timer destructor start 315206436 countdownMs=999 isTimerRunning=1 next=0 periodMs=999 previous=0
Timer destructor end 315206436 countdownMs=999 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor start 82925372 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 82925372 countdownMs=0 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::isThreadRunning() Name:Juce Timer ID:e1c
Thread::signalThreadShouldExit() Name:Juce Timer ID:e1c
Thread::notify() Name:Juce Timer ID:e1c
1000x
Thread::isThreadRunning() Name:Juce Timer ID:e1c
Thread::isThreadRunning() Name:Juce Timer ID:e1c
Thread::isThreadRunning() Name:Juce Timer ID:e1c
Thread::isThreadRunning() Name:Juce Timer ID:e1c
Thread::isThreadRunning() Name:Juce Timer ID:e1c
Thread::isThreadRunning() Name:Juce Timer ID:e1c
Thread::isThreadRunning() Name:Juce Timer ID:e1c
etc.
Cubasesx3.exe has triggered a breakpoint
** Warning - Forced thread termination **
Thread::stopThread Name:Juce Timer ID:0
Thread::isThreadRunning() Name:Juce Timer ID:0
Thread::stopThread Name:Juce Timer ID:0
Thread::~Thread() Name:Juce Timer ID:0
Timer destructor start 82921212 countdownMs=250 isTimerRunning=0 next=0 periodMs=0 previous=0
Timer destructor end 82921212 countdownMs=250 isTimerRunning=0 next=0 periodMs=0 previous=0
Thread::stopAllThreads
Thread::getNumRunningThreads()
Detected memory leaks!
Dumping objects ->
c:\cpp_projects\juce\src\juce_core\text\juce_string.cpp(108) : {2144441} normal block at 0x15010918, 84 bytes long.
Data: < T h r > 01 00 00 00 24 00 00 00 0A 00 54 00 68 00 72 00
c:\cpp_projects\juce\src\juce_appframework\events\juce_message.h(81) : {2133745} normal block at 0x108154D0, 24 bytes long.
Data: < > FC 96 FB 0A CD CD CD CD CD CD CD CD CD CD CD CD
c:\cpp_projects\juce\src\juce_appframework\events\juce_message.h(81) : {2115503} normal block at 0x15010418, 24 bytes long.
Data: < > FC 96 FB 0A 00 00 00 00 00 00 00 00 00 00 00 00
c:\cpp_projects\juce\src\juce_core\containers\juce_arrayallocationbase.h(96) : {116835} normal block at 0x110027C8, 320 bytes long.
Data: < DD > FF BB BB FF FF 44 44 FF 00 00 00 FF 00 00 00 FF
c:\cpp_projects\juce\src\juce_core\containers\juce_arrayallocationbase.h(96) : {116833} normal block at 0x11002AA8, 320 bytes long.
Data: < e > 00 01 00 01 01 01 00 01 02 01 00 01 01 65 00 01
c:\cpp_projects\juce\src\juce_appframework\gui\components\lookandfeel\mylookandfeel.h(194) : {116800} normal block at 0x11002748, 64 bytes long.
Data: <4l > 34 6C FB 0A C0 BA FB 0A 00 00 00 00 00 00 00 00
Object dump complete.
Detected memory leaks!
Dumping objects ->
c:\cpp_projects\juce\src\juce_core\text\juce_string.cpp(108) : {2144441} normal block at 0x15010918, 84 bytes long.
Data: < T h r > 01 00 00 00 24 00 00 00 0A 00 54 00 68 00 72 00
c:\cpp_projects\juce\src\juce_appframework\events\juce_message.h(81) : {2133745} normal block at 0x108154D0, 24 bytes long.
Data: < > FC 96 FB 0A CD CD CD CD CD CD CD CD CD CD CD CD
c:\cpp_projects\juce\src\juce_appframework\events\juce_message.h(81) : {2115503} normal block at 0x15010418, 24 bytes long.
Data: < > FC 96 FB 0A 00 00 00 00 00 00 00 00 00 00 00 00
c:\cpp_projects\juce\src\juce_core\containers\juce_arrayallocationbase.h(96) : {116835} normal block at 0x110027C8, 320 bytes long.
Data: < DD > FF BB BB FF FF 44 44 FF 00 00 00 FF 00 00 00 FF
c:\cpp_projects\juce\src\juce_core\containers\juce_arrayallocationbase.h(96) : {116833} normal block at 0x11002AA8, 320 bytes long.
Data: < e > 00 01 00 01 01 01 00 01 02 01 00 01 01 65 00 01
c:\cpp_projects\juce\src\juce_appframework\gui\components\lookandfeel\mylookandfeel.h(194) : {116800} normal block at 0x11002748, 64 bytes long.
Data: <4l > 34 6C FB 0A C0 BA FB 0A 00 00 00 00 00 00 00 00
Object dump complete.
The program ‘[760] Cubasesx3.exe: Native’ has exited with code 0 (0x0).