Browse files

changing order at UnloadEffect, remove pointer from data structure fi…

…rst, then delete. This prevents the structure from holding an invalid pointer
  • Loading branch information...
1 parent 6bcbbe8 commit a97746ed77706f234b42570bbd531ba4f2b794d7 @armadillu armadillu committed Jun 12, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 addons/ofxiPhone/src/SoundEngine.cpp
View
5 addons/ofxiPhone/src/SoundEngine.cpp
@@ -1083,12 +1083,11 @@ class OpenALObject
OSStatus UnloadEffect(UInt32 inEffectID)
{
- // [FIXED] SoundEngineEffect should be deleted before remove from the map
- SoundEngineEffect *theEffect = mEffectsMap->Get(inEffectID);
+ mEffectsMap->Remove(inEffectID); //remove pointer from structure first
+ SoundEngineEffect *theEffect = mEffectsMap->Get(inEffectID); //then delete
if (theEffect){
delete theEffect;
}
- mEffectsMap->Remove(inEffectID);
return 0;
}

0 comments on commit a97746e

Please sign in to comment.