Fixed crash bug in sndmanager.cpp

This commit is contained in:
Nicolay Korslund 2010-08-30 23:51:47 +02:00
parent 3df4362b33
commit b486f12a5f
2 changed files with 16 additions and 5 deletions

2
mangle

@ -1 +1 @@
Subproject commit 932465442bd97c3bcb3a8630414c16bdd887fa9f
Subproject commit 3324f6494c021e3dc69cd76ace5ff25a52e4bcce

View file

@ -149,15 +149,26 @@ public:
// Update all sounds
void updateAll()
{
for(ManagedSound *s = list.getHead(); s != NULL; s=s->next)
s->update();
ManagedSound *s = list.getHead();
while(s)
{
ManagedSound *cur = s;
// Propagate first, since update() may delete object
s = s->next;
cur->update();
}
}
// Detach and unlock all sounds
void detachAll()
{
for(ManagedSound *s = list.getHead(); s != NULL; s=s->next)
s->detach();
ManagedSound *s = list.getHead();
while(s)
{
ManagedSound *cur = s;
s = s->next;
cur->detach();
}
}
};