If an EventInstance has a callback that uses EventInstance::release(), fmod will crash on a call to EventInstance::stop(FMOD_STUDIO_STOP_IMMEDIATE).
Here is a simple callback from the examples that just calls EventInstance::release():
FMOD_RESULT F_CALLBACK eventCallback(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, void* parameters)
if (type == FMOD_STUDIO_EVENT_CALLBACK_STOPPED)
ERRCHECK( ((FMOD::Studio::EventInstance*)parameters)->release() );
Assuming I have an already created eventInstance, the following code will crash fmod:
ERRCHECK( eventInstance.setCallback(&eventCallback) );
ERRCHECK( eventInstance.stop(FMOD_STUDIO_STOP_IMMEDIATE) );
I am guessing this is because FMOD_STUDIO_STOP_IMMEDIATE releases the event instance internally. Can anybody confirm this? Currently I am working around this by setting the callback to null before I use FMOD_STUDIO_STOP_IMMEDIATE.
- Kai asked 6 years ago
Please login first to submit.