wildicv/cAudio — Issue #6: cAudioManager->releaseAllSources bug
Author: northWind87
Created: 2012-02-09 16:21:58+00:00
State: open

**Problem:**

```cpp
void cAudioManager::releaseAllSources()
{
cAudioMutexBasicLock lock(Mutex);
size_t count = audioSources.size();
for(size_t i=0; idrop();
}
```

As sources are dropped, they are erased from audioSources while count and i remain the same. This causes an index out of bounds exception sooner or later.

**Solution:**

```cpp
void cAudioManager::releaseAllSources()
{
cAudioMutexBasicLock lock(Mutex);
cAudioVector::Type tempList(audioSources.begin(), audioSources.end());
size_t count = audioSources.size();
for(size_t i=0; idrop();
}
```