key value observing crash on removal
key value observing crash on removal
- Subject: key value observing crash on removal
- From: Francisco Tolmasky <email@hidden>
- Date: Mon, 23 Feb 2004 20:36:15 -0800
I'm trying to use Key value observing in my nscell subclass, and for
some reason it crashes when i remove observers. Here is my
setObjectValue: code:
- (void)setObjectValue:(id)anObject
{
id previous= [self objectValue];
if(previous)
{
[self retain];
[previous removeObserver: self forKeyPath: @"a"];
}
[super setObjectValue: anObject];
[anObject
addObserver: self forKeyPath: @"a"
options: (NSKeyValueObservingOptionNew |
NSKeyValueObservingOptionOld) context: NULL];
}
This cell is used by my tableview, and created by an nsarraycontroller.
Basically I register a so that when a changes the cell updates. Now,
for some reason this crashes upon the second addition of an object.
Does anybody know why?
Francisco Tolmasky
email@hidden
http://users.adelphia.net/~ftolmasky
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.