1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-18 13:12:50 +00:00

Fix crash at shutdown. updater() is still referenced by OGRE after it is deleted, since the SoundImpl is deleted by ~Engine before mRoot is deleted.

This commit is contained in:
athile 2010-09-07 15:21:38 +01:00
parent 11d0eb0bf2
commit 11022f1520

View File

@ -104,6 +104,12 @@ namespace MWSound
root->addFrameListener(&updater);
}
SoundImpl::~SoundImpl()
{
Ogre::Root::getSingleton().removeFrameListener(&updater);
cameraTracker.unfollowCamera();
}
std::string toMp3(const std::string &str)
{
std::string wav = str;
@ -147,10 +153,10 @@ namespace MWSound
const ESM::Sound *snd = store.sounds.search(soundId);
if(snd == NULL) return "";
volume *= snd->data.volume / 255.0;
volume *= snd->data.volume / 255.0f;
// These factors are not very fine tuned.
min = snd->data.minRange * 7;
max = snd->data.maxRange * 2000;
min = snd->data.minRange * 7.0f;
max = snd->data.maxRange * 2000.0f;
return convertPath(snd->sound);
}