App crashing upon exit, argh help :)

libc++abi.dylib: terminate called throwing an exception

Anyone got any ideas? Some screenshots below…

Many thanks

Ok more digging around, it seems to be ofSoundPlayer causing the issue.

If I take emptyExample, build run and then press the home button, no crash.

If I add to testApp.h :

ofSoundPlayer testSound;

thats it, then the above happens.

Any ideas? Thanks

If using an addon works for your case, it might be worth it to check out julapy’s ofxiOSSoundPlayer (https://github.com/julapy/ofxiOSSoundPlayer/), since it’s a pretty lightweight wrapper around apple’s own AVAudioPlayer, which should Do The Right Thing.

so I just put some print statements into ~ofxOpenALSoundPlayer :

  
  
ofxOpenALSoundPlayer::~ofxOpenALSoundPlayer() {   
	printf("~ofxOpenALSoundPlayer\n");  
	unloadSound();  
	numSounds--;  
	printf("~ofxOpenALSoundPlayer 1\n");  
	soundPlayerLock.lock();  
    printf("~ofxOpenALSoundPlayer 1a\n");  
	for(int i=0;i<soundPlayers.size();i++)  
	{  
        printf("~ofxOpenALSoundPlayer 2\n");  
		if(soundPlayers[i] == this)  
		{  
            printf("~ofxOpenALSoundPlayer 2a\n");  
			soundPlayers.erase(soundPlayers.begin()+i);  
			break;  
		}  
	}  
    printf("~ofxOpenALSoundPlayer 2b\n");  
	soundPlayerLock.unlock();  
	printf("~ofxOpenALSoundPlayer 3\n");  
	if(numSounds==0) {  
		closeSoundEngine();  
		soundPlayers.clear();  
	}  
    printf("~ofxOpenALSoundPlayer 4\n");  
}  
  

and when i press the home button i just see…

~ofxOpenALSoundPlayer
~ofxOpenALSoundPlayer 1
libc++abi.dylib: terminate called throwing an exception

I’ve been getting the same issues.
I usually get crashes at:
closeSoundEngine();

you might try commenting that out and see if you still get crashes.

right, ive just found the issue and solution here

https://github.com/openframeworks/openFrameworks/blob/master/addons/ofxiPhone/src/sound/ofxOpenALSoundPlayer.cpp

i copied in the lasted ofxOpenALSoundPlayer.cpp from that commit and seems to solve the problem. Quite a critical fix for anyone using iOS.

thanks