Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 11, 2011, 2:20:13 PM (14 years ago)
Author:
landauf
Message:

fixed a bug which caused the application to crash if the game was ended while cross-fading ambient sound. in particular AmbientSound registered itself again at SoundManager as soon as SoundManager was deleted. added a bool to prevent this behavior.

Location:
code/trunk/src/orxonox/sound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/sound/SoundManager.cc

    r7284 r7855  
    7070    {
    7171        RegisterRootObject(SoundManager);
     72       
     73        this->bDestructorCalled_ = false;
    7274
    7375        // See whether we even want to load
     
    163165    {
    164166        // Erase fade lists because of the smart pointers
     167        this->bDestructorCalled_ = true;
    165168        this->fadeInList_.clear();
    166169        this->fadeOutList_.clear();
     
    343346    void SoundManager::registerAmbientSound(AmbientSound* newAmbient)
    344347    {
    345         if (newAmbient != NULL)
     348        if (newAmbient != NULL && !this->bDestructorCalled_)
    346349        {
    347350            for (AmbientList::const_iterator it = this->ambientSounds_.begin(); it != this->ambientSounds_.end(); ++it)
     
    366369    void SoundManager::unregisterAmbientSound(AmbientSound* oldAmbient)
    367370    {
    368         if (oldAmbient == NULL || ambientSounds_.empty())
     371        if (oldAmbient == NULL || ambientSounds_.empty() || this->bDestructorCalled_)
    369372            return;
    370373
  • code/trunk/src/orxonox/sound/SoundManager.h

    r6417 r7855  
    146146        std::vector<ALuint> availableSoundSources_;
    147147        std::vector<std::pair<ALuint, BaseSound*> > usedSoundSources_;
     148       
     149        bool bDestructorCalled_; ///< Becomes true if the destructor is called - used to prevent ambient sounds from registering after the lists were cleared
    148150
    149151        static SoundManager* singletonPtr_s;
Note: See TracChangeset for help on using the changeset viewer.