Possible Bug in Thread::isThreadRunning


#1

The code was built on the windows platform with VC++ 8, using the latest version of Juce. My app called Thread::isThreadRunning on a thread instance that was never started. It returned true instead of false because Thread::threadHandle_ was set to 0xfeeefeee which is what windows initializes unallocated memory when running in the debug configuration.


#2

That variable gets initialised to 0, so your diagnosis sounds fishy to me… Maybe your thread object is a dangling pointer or something?


#3

I think 0xfeeefeee actually means that the memory has been freed; sort of a hexadecimal pun.


#4

Matt, I think you’re right. It turned out that my ordering of destructors was incorrect: my code deleted an object whose thread is later stopped by a destructor of an object using the thread.