DenisKoronchik
18-03-2013 15:44:17
Has compiled under OSX 10.8.2 and take a crash.
Before that this code works on older versions. This code works on Windows, iOS. But crashes on OSX.
Has found why.
Problem is in OgreOggStaticWavSound::setSource function (possible for other implementations of sounds). It calls twicely on destroy.
First:
And sound source setup to 0 value.
After that calls
That calls destructor of sound object, where calls function _relase
That calls setSource with 0 parameter second time. Where i'm getting crash under OSX in lines
So need to fix that error, because OpenAL implementation for latest OSX possible raise exception, when trying to stop 0 source.
Before that this code works on older versions. This code works on Windows, iOS. But crashes on OSX.
Has found why.
Problem is in OgreOggStaticWavSound::setSource function (possible for other implementations of sounds). It calls twicely on destroy.
First:
/*/////////////////////////////////////////////////////////////////*/
bool OgreOggSoundManager::_releaseSoundSource(OgreOggISound* sound)
{
if (!sound) return false;
if (sound->getSource()==AL_NONE) return true;
// Get source
ALuint src = sound->getSource();
// Valid source?
if(src!=AL_NONE)
{
ALuint source=AL_NONE;
// Detach source from sound
sound->setSource(source);
....
And sound source setup to 0 value.
After that calls
/*/////////////////////////////////////////////////////////////////*/
void OgreOggSoundManager::_releaseSoundImpl(OgreOggISound* sound)
{
...
// Delete sound
OGRE_DELETE_T(sound, OgreOggISound, Ogre::MEMCATEGORY_GENERAL);
}
That calls destructor of sound object, where calls function _relase
void OgreOggStaticWavSound::_release()
{
ALuint src=AL_NONE;
setSource(src);
OgreOggSoundManager::getSingleton()._releaseSharedBuffer(mAudioName, mBuffer);
mPlayPosChanged = false;
mPlayPos = 0.f;
}
That calls setSource with 0 parameter second time. Where i'm getting crash under OSX in lines
// Need to stop sound BEFORE unqueuing
alSourceStop(mSource);
So need to fix that error, because OpenAL implementation for latest OSX possible raise exception, when trying to stop 0 source.