our app gets every image from camera (CameraDevice::Listener::imageReceived callback), treats it and then draws the result.
There is an option of stopping/restarting a the camera, and switching between devices.
In mac, we postpone the treatment of the image received to the message loop by saving the image and then calling handleAsyncUpdate.
But then, we encounter a recurrent crash when quitting the app or when switching cameras. I imagine it comes from the fact that the imageReceived callback continues being called while we cameraDevice object is under detruction.
I tried a lot of thing, and did not succeed to figure out what is the right way for handling this.
One way that seems to work more or less, is to implement an OnQuit function, that toggles an bOnQuit flag to true, and checking this flag everytime we enter imageReceived callback, what prevents the handleAsyncUpdate to be called when quitting the app.
Thanks for help