]> git.mxchange.org Git - simgear.git/commitdiff
sound: fix "source" resource leak
authorThorstenB <brehmt@gmail.com>
Sun, 4 Dec 2011 19:16:36 +0000 (20:16 +0100)
committerThorstenB <brehmt@gmail.com>
Sun, 4 Dec 2011 19:16:36 +0000 (20:16 +0100)
Sound resources were eaten up when a sample could not be loaded.
Restores sound for aircraft attempting to use stereo files for sound effects.
However, when loading fails, sound code still tries to load the same file
again and again (always resulting in the same "stereo files not supported"
error), which slows down simulation.

simgear/sound/sample_group.cxx

index 1af1f268dd0e1997b5c41e118477ad967b008929..ac04d99e8f8aa56f8d314c5fa06ecd426645160d 100644 (file)
@@ -156,7 +156,10 @@ void SGSampleGroup::update( double dt ) {
                 else
                 {
                     if (_smgr->request_buffer(sample) == SGSoundMgr::NO_BUFFER)
+                    {
+                        _smgr->release_source(source);
                         continue;
+                    }
 
                     // start playing the sample
                     ALuint buffer = sample->get_buffer();