From fb95756a50ca0b77e0588c4c249c26b00bcf6011 Mon Sep 17 00:00:00 2001 From: athile Date: Tue, 7 Sep 2010 15:17:46 +0100 Subject: [PATCH] Fix crash at shutdown --- sound/clients/ogre_listener_mover.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sound/clients/ogre_listener_mover.hpp b/sound/clients/ogre_listener_mover.hpp index d1cfcb65c..739c08a13 100644 --- a/sound/clients/ogre_listener_mover.hpp +++ b/sound/clients/ogre_listener_mover.hpp @@ -9,7 +9,7 @@ namespace Mangle { namespace Sound { /** This class lets a sound listener (ie. the SoundFactory) track a - given camera in Ogre3D. The poisition and orientation of the + given camera in Ogre3D. The position and orientation of the listener will be updated to match the camera whenever the camera is moved. */ @@ -27,6 +27,16 @@ namespace Sound { camera->addListener(this); } + void unfollowCamera() + { + // If the camera is null, this object wasn't following a camera. + // It doesn't make sense to call unfollow + assert(camera != NULL); + + camera->removeListener(this); + camera = NULL; + } + private: Mangle::Sound::SoundFactoryPtr soundFact; Ogre::Camera *camera;