"background gpu access not permitted"


I was wondering about how one should properly close a program when it is exited or loses focus. My app works fine until I regain focus, and then it crashes with the error:
sgx error (background gpu access not permitted)

any ideas?

I tried a dumb hack that would flip a boolean in exit() and lostFocus() that would disable update() and draw() but I am still getting the error.

edit: I’ve done some more investigating, and it appears this only happens when I use ofxALSoundPlayer. It seems to happen even if I just have one defined ofxALSoundPlayer variable without even calling any functions in setup, update or draw. Whats strange is that ofxALSoundPlayer works fine when I use it, it just causes this crash on restarting my app.

edit2: on further investigation, it seems that the OpenAL example also suffers from this problem

edit3: haha ok, I fixed my problem by using the code here.