Unsafe unretained & callbacks from audio thread
On mobile, apologies for formatting or misses names
My app has a timing listener which runs on the audio thread. At the end of this callback, I want to notify my obj-c object that something happened, so I have a struct with an __unsafe__unretained pointer to the object on my c callback, and I pass this struct in the block sent to performOnMainThread.
This block does run on the correct thread by sometimes crashes as the obj-c object has already been destroyed and the unsafe pointer is now invalid.
My question is: how my c timing callback ensure that it won't send a message to an obj-c object that has been destroyed?