FMOD - Crash on Closure Releasing Resources
In an initialization routine, I have the code
Code:
HRSRC hrsrc = ::FindResource( NULL, MAKEINTRESOURCE(IDB_ORIGINALSONG), TEXT("BIN") );
HGLOBAL rsc = ::LoadResource( NULL, hrsrc );
LPVOID lock = ::LockResource( rsc );
DWORD size = ::SizeofResource( NULL, hrsrc );
FMOD::System * fmodSystem = 0;
FMOD_CREATESOUNDEXINFO fmodExInfo = { 0 };
fmodExInfo.cbsize = sizeof( FMOD_CREATESOUNDEXINFO );
fmodExInfo.length = size;
fmodSystem = m_parent.getFmodSystem();
fmodSystem->createSound( LPCSTR(lock), FMOD_OPENMEMORY, &fmodExInfo, &m_sound );
fmodSystem->playSound( FMOD_CHANNEL_FREE, m_sound, false, &m_channel );
And in the destruction routine, that will be called when the app is closed, I say.
Code:
m_channel->stop();
m_sound->release();
It crashes somewhere inside of the release of my m_sound.
Could it have anything to do with this: http://support.microsoft.com/default...b;en-us;193678 Because my destruction things go from lowest level things up to the top, which would destroy the HWND before getting to releasing the sound. I thought that FMOD makes a copy of everything. But, um, am I right? Anyone have any ideas?