I have random EXC_BAD_ACCESS KERN_INVALID_ADDRESS , but I can not specify the source. However, I am wondering if this could be:
I have an audio_queue created like this:
_audio_queue = dispatch_queue_create("AudioQueue", nil);
which I use to create and access an object named _audioPlayer :
dispatch_async(_audio_queue, ^{ _audioPlayer = [[AudioPlayer alloc] init]; });
The audio player belongs to MovieView :
@implementation MovieView { AudioPlayer *_audioPlayer }
Then, in the dealloc MovieView method, I:
- (void)dealloc { dispatch_async(_audio_queue, ^{ [_audioPlayer destroy]; }); }
It is acceptable? I think that by the time the block is called, MovieView would have been freed, and when you try to access _audioPlayer it no longer exists. Is this the case?
My crash report says:
MovieView.m line 0 __destroy_helper_block_
objective-c
Snowman
source share