Strange crash in Array


#1

On OS X, my app crashed (on a friend’s Mac):

Thread 6 Crashed:
0 com.apple.myCarbonApp 0x00140ce6 juce::Array<int, juce::DummyCriticalSection>::add(int) + 36
1 com.apple.myCarbonApp 0x000210b9 MP3Reader::onMP3FrameScanned(int, int, int) + 31
2 com.apple.myCarbonApp 0x00021876 MP3ScanThread::mp3FrameScan(juce::InputStream*) + 414
3 com.apple.myCarbonApp 0x00021fba MP3ScanThread::run() + 74
4 com.apple.myCarbonApp 0x00071ee1 juce::Thread::threadEntryPoint(juce::Thread*) + 247
5 com.apple.myCarbonApp 0x00077503 juce::threadEntryProc(void*) + 17
6 libSystem.B.dylib 0x90d366f5 _pthread_start + 321
7 libSystem.B.dylib 0x90d365b2 thread_start + 34

I wonder how it is possible that it crashed in the Array class. Any ideas?


#2

well that dump shows that the crash happened from some thread, and you’re using an array with a dummy critical section; you should be using a normal critical section to have a thread-safe array. Try changing your array declaration to Array<int,CriticalSection> instead of using the default DummyCriticalSection template parameter.


#3

Thanks for the tip Haydxn, but it was me forcing the thread to stop and that somehow provoked a crash, so now I’m using stopThread(-1).