Hi again,
in my project, I have a managed object A, that has a relationship to an other
managed object B, itself in relation with a third object C (which happens to be
a CALayer, therefore is not part of Core Data): A -> B -> C.
The object A I register in a NSArrayController, whose content is linked to a
NSCollectionView. The NSView I use to visually represent the NSArrayController
contents includes a slider that observes a parameter of C (more specifically,
opacity) through KVO.
So far, so good.
I have a NSButton in C to remove from the array controller the A object it
represents. However, each time I click on that button, I first get a warning
telling me that I remove an observed object before releasing the observer, and
then the program crash, albeit:
- I've set the relation option between A and B to leave B alone when A is
deallocated;
- I keep a temporary pointer on A and release C before A is removed from the
array controller.
NSArrayController controller;
id A, B, C
(void)removeA:(id)sender {
id tmp = [A retain];
[controller removeObject:A];
[[[A getB] getC] release];
[[A getB] release];
[tmp release];
}
It seems the object in the NSCollectionView persists some time after A is
removed from the array. Of course, I could twist the action and redirect it
somehow to the slider so it would unregister (which would mean somehow
subclassing it) and then pass a message the remove message to A. Is there any
simpler solution ?
I hope this is not too obscure.
Thanks,
Vincent_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]