fix crash if a sound is played, copied, and then the parent is given over

to RageSoundManager; don't think this ever actually happens
This commit is contained in:
Glenn Maynard
2004-05-01 05:13:09 +00:00
parent 051cc33b43
commit 84ac4d3fc9
+10
View File
@@ -98,6 +98,16 @@ void RageSoundManager::Update(float delta)
if( !(*it)->IsPlaying() )
ToDelete.insert( *it );
/* Don't delete any sounds that are the parent of another sound. Always delete
* child sounds first. */
for( it = owned_sounds.begin(); it != owned_sounds.end(); ++it )
if( (*it)->GetOriginal() != (*it) ) // child
{
set<RageSound *>::iterator parent = ToDelete.find( (*it)->GetOriginal() );
if( parent != ToDelete.end() )
ToDelete.erase( parent );
}
for( it = ToDelete.begin(); it != ToDelete.end(); ++it )
owned_sounds.erase( *it );
g_SoundManMutex.Unlock(); /* finished with owned_sounds */