Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 3, 2009, 7:48:42 PM (14 years ago)
Author:
rgrieder
Message:

Fixed two problems in the sound system: Buffers did not get removed from the list in the SoundManager and failed creation was not caught.

File:
1 edited

Legend:

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

    r6208 r6232  
    484484        else
    485485        {
    486             shared_ptr<SoundBuffer> buffer(new SoundBuffer(fileInfo));
     486            shared_ptr<SoundBuffer> buffer;
     487            try
     488            {
     489                buffer.reset(new SoundBuffer(fileInfo));
     490            }
     491            catch (...)
     492            {
     493                COUT(1) << Exception::handleMessage() << std::endl;
     494                return shared_ptr<SoundBuffer>();
     495            }
    487496            this->soundBuffers_[fileInfo->group + '/' + fileInfo->filename] = buffer;
    488497            return buffer;
     
    494503        std::map<std::string, weak_ptr<SoundBuffer> >::iterator it
    495504            = this->soundBuffers_.find(fileInfo->group + '/' + fileInfo->filename);
    496         if (it == this->soundBuffers_.end())
     505        if (it != this->soundBuffers_.end())
    497506            this->soundBuffers_.erase(it);
    498507    }
Note: See TracChangeset for help on using the changeset viewer.