• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
key value observing crash on removal
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: changing a files name?
  • Next by Date: Re: mmalc's Controller examples
  • Previous by thread: Re: problems in measuring text rendering size
  • Next by thread: sheet not attaching to parent?
  • Index(es):
    • Date
    • Thread