Fixed a compile error and a crash bug.
Fixed a compile error in cPluginManager.cpp. Fixed a crash bug in cAudioManager.cpp. The iterator was becoming invalid as dropping an audio source was removing it from the vector being iterated through.
This commit is contained in:
parent
de42f649c4
commit
9714a3a903
|
@ -576,11 +576,16 @@ namespace cAudio
|
|||
cAudioMutexBasicLock lock(Mutex);
|
||||
cAudioVector<IAudioSource*>::Type::iterator audioSourcesIter;
|
||||
|
||||
for(audioSourcesIter = audioSources.begin(); audioSourcesIter != audioSources.end(); audioSourcesIter++)
|
||||
cAudioVector<IAudioSource*>::Type deleteSources;
|
||||
for(audioSourcesIter = audioSources.begin(); audioSourcesIter != audioSources.end(); ++audioSourcesIter)
|
||||
{
|
||||
if((*audioSourcesIter))
|
||||
(*audioSourcesIter)->drop();
|
||||
deleteSources.push_back(*audioSourcesIter);
|
||||
}
|
||||
for(audioSourcesIter = deleteSources.begin(); audioSourcesIter != deleteSources.end(); ++audioSourcesIter)
|
||||
(*audioSourcesIter)->drop();
|
||||
|
||||
deleteSources.clear();
|
||||
audioSources.clear();
|
||||
audioIndex.clear();
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace cAudio
|
|||
it2->first->drop();
|
||||
if(DYNLIB_UNLOAD(it2->second))
|
||||
{
|
||||
getLogger()->logError("cPluginManager", "Plugin Error: %s.", fromUTF8(getError()));
|
||||
getLogger()->logError("cPluginManager", "Plugin Error: %s.", toUTF8(getError()));
|
||||
}
|
||||
DynamicallyLoadedPlugins.erase(it2->first);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue