Getting error in log loading bank after unloading

If I try to load a bank immediately after unloading it, I see the following error:
/Users/raymond/jenkins/workspace/Build__1.3__API_Mac/studio_api/src/fmod_asynccommand_impl.cpp(971) : FMOD error (33) : An invalid object handle was used.

The 2nd load does not fail but I’d like to know if I am doing something wrong.

I call:
loadBankFile ( filename, FMOD_STUDIO_LOAD_BANK_NORMAL, &this->mBank );
loadBankFile ( filename, FMOD_STUDIO_LOAD_BANK_NORMAL, &this->mBank );

The problem was with double unloading the bank.


That message appears when attempting to unload a bank that has not been properly created, either due to a double unload, or due to a failed loadBankFile (which can occur if a bank is trying to be loaded twice). It isn’t a problem in itself, although it does mean that the unload command has not been executed.

You should not be seeing it if you just call load, unload, load, in that order. Are those 3 commands the only ones you have issued? You can check error codes of loadBankFile and unload and see they returned an error. Additionally, before you call unload you can query the bank status with Bank::getLoadingState and see what the bank state is.

If you are still getting the problem, then a bigger code snippet and/or FMOD log file would help tracking down what you are seeing.

I can imagine this has to do with the asynchronous loading/unloading of banks. I got here btw when looking for the same error; this is due to loading the same bank twice, but then also calling unload twice. It seems I must cache the bank myself to avoid getting this error, which makes the point of caching the bank file a bit moot.