We have had this weird issue. When we instantiated an object, we also instantiate a property that belongs to that object:
-(instancetype)init
{
self = [super init];
if (self) {
[self setDocument];
}
return self;
}
-(void)setDocument:
{
_flatGraphicsArrayController = [[NSArrayController alloc] initWithContent:doc.flattenedObjects];
}
...and occasionally a EXC_BAD_ACCESS
happens at the setting of _flatGraphicsArrayController
This crash has been determined to be caused by sending that NSKeyValueNotifyObserver
message to a deallocated object, an object that appears to be observing changes to flatGraphicsArrayController
To me, this is very confusing because the object that owns this property is just being instantiated, so how could anything possibly be observing changes to the property?
Was somebody registered to observe a specific memory address (if that's how it works), and then the flatGraphicsArrayController
somehow took that space in memory, while the observer was deallocated?