My iOS app (using openFrameworks) crashes 30-40% of the time on launch on this line:
if(soundInputPtr!=NULL) soundInputPtr->audioIn(tempBuffer, ioData
Read the stack trace and go where it tells you.
#0 0x00008ff2 in Gameplay::listen() at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/c++/4.2.1/bits/basic_string.h:238
In my copy of that file, that code reads as follows:
void _M_dispose(const _Alloc& __a) { #ifndef _GLIBCXX_FULLY_DYNAMIC_STRING if (__builtin_expect(this != &_S_empty_rep(), false)) #endif if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) //Line 238: _M_destroy(__a); } // XXX MT
Looking elsewhere in the file, that method is called by basic_string
's destructor to release the string's private storage (_M_rep()
).
For Objective-C objects, a crash like that generally indicates that the object itself (in this case, the string) was trashed, usually by over-releasing it. But I don't know how applicable that is to C++ objects; a lot of things work differently in C++ vs. Objective-C.
We can probably tell you more if you show us the code for recordingCallback
, making sure to include line 143 of that file (again, see the stack trace for why I'm pointing there).