iOS crash when loading wav files


#1

I'm using a set of background threads to load a number of wav files (quite a lot, about 70) and occasionally I'm getting this crash:

 

Thread 7 Crashed:
0   Giggler                           0x00216204 juce::AudioData::Int32::setAsInt32LE(int) (juce_AudioDataConverters.h:213)
1   Giggler                           0x00220122 void juce::AudioData::Int32::copyFromLE<juce::AudioData::Pointer<juce::AudioData::Int16, juce::AudioData::LittleEndian, juce::AudioData::Interleaved, juce::AudioData::Const> >(juce::AudioData::Pointer<juce::AudioData::Int16, juce::AudioData::LittleEndian, juce::AudioData::Interleaved, juce::AudioData::Const>&) (juce_AudioDataConverters.h:217)
2   Giggler                           0x0022007a void juce::AudioData::LittleEndian::copyFrom<juce::AudioData::Pointer<juce::AudioData::Int16, juce::AudioData::LittleEndian, juce::AudioData::Interleaved, juce::AudioData::Const>, juce::AudioData::Int32>(juce::AudioData::Int32&, juce::AudioData::Pointer<juce::AudioData::Int16, juce::AudioData::LittleEndian, juce::AudioData::Interleaved, juce::AudioData::Const>&) (juce_AudioDataConverters.h:89)
3   Giggler                           0x0021ff2a void juce::AudioData::Pointer<juce::AudioData::Int32, juce::AudioData::NativeEndian, juce::AudioData::NonInterleaved, juce::AudioData::NonConst>::convertSamples<juce::AudioData::Pointer<juce::AudioData::Int16, juce::AudioData::LittleEndian, juce::AudioData::Interleaved, juce::AudioData::Const> >(juce::AudioData::Pointer<juce::AudioData::Int16, juce::AudioData::LittleEndian, juce::AudioData::Interleaved, juce::AudioData::Const>, int) const (juce_AudioDataConverters.h:448)
4   Giggler                           0x0021ef90 juce::AudioFormatReader::ReadHelper<juce::AudioData::Int32, juce::AudioData::Int16, juce::AudioData::LittleEndian>::read(int**, int, int, void const*, int, int) (juce_AudioFormatReader.h:250)
5   Giggler                           0x0021ecda juce::WavAudioFormatReader::readSamples(int**, int, int, long long, int) (juce_WavAudioFormat.cpp:749)
6   Giggler                           0x00212524 juce::AudioFormatReader::read(int* const*, int, long long, int, bool) (juce_AudioFormatReader.cpp:70)
7   Giggler                           0x0021287a juce::AudioFormatReader::read(juce::AudioSampleBuffer*, int, int, long long, bool, bool) (juce_AudioFormatReader.cpp:138)
8   Giggler                           0x002efb3c LoadData::run() (MySampler.cpp:68)
9   Giggler                           0x0023ac10 juce::Thread::threadEntryPoint() (juce_Thread.cpp:93)
10  Giggler                           0x0023b052 juce::juce_threadEntryPoint(void*) (juce_Thread.cpp:105)
11  Giggler                           0x00245d54 threadEntryProc (juce_posix_SharedCode.h:852)
12  libsystem_c.dylib                 0x34ee930e _pthread_start + 306
13  libsystem_c.dylib                 0x34ee91d4 thread_start + 4


Could this be something that's caused by too slow reading rates from the disk? Seems a likely explanation, but just to be sure...


#2

My first thoughts on seeing a crash like that would be that you must be giving it the wrong size buffer, so it's overwriting memory?