Skip to content

Commit

Permalink
changing order at UnloadEffect, remove pointer from data structure fi…
Browse files Browse the repository at this point in the history
…rst, then delete. This prevents the structure from holding an invalid pointer
  • Loading branch information
armadillu committed Jun 12, 2012
1 parent 6bcbbe8 commit a97746e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions addons/ofxiPhone/src/SoundEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a97746e

Please sign in to comment.