• 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
Need a native guide through "Cannot remove an observer" woods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need a native guide through "Cannot remove an observer" woods


  • Subject: Need a native guide through "Cannot remove an observer" woods
  • From: Jack Repenning <email@hidden>
  • Date: Fri, 25 Apr 2008 17:49:19 -0700

I'm getting this message. I think I know what all the words mean, and I've crawled the KVC and KVO manuals again just to be certain, but I'm not getting any inspirations on what I'm supposed to do about this situation. Having seen this message, if I let the program continue very much longer (_not_ very much longer, actually), I'm likely to get a BAD_ACCESS crash, which I suppose must be related.

2008-04-25 17:13:11.191 SCPluginUIDaemon[20884:10b]
	Exception raised during posting of notification.  Ignored.
	exception: 'Cannot remove an observer <NSKeyValueObservance 0x3807e0>
	for the key path "kind" from <SVNWCEntry 0x34bfa0>
	because it is not registered as an observer.'
	invoked observer method: '*** -[SVNInfoUI windowWillClose:]'
	observer: 0x34c380
	notification name: 'NSWindowWillCloseNotification'

I guess part of my confusion is the paradox between "cannot remove an observer" and "it is not registered as an observer." If it's not registered, who's trying to remove it? And why? And what have I done to confuse the poor bloke?

The SVNInfoUI is File's Owner to the NIB, and delegate, and this happens when I close the window (all that sounds right). -[SVNInfoUI windowWillClose:] does, indeed, do [self setEntry:nil], where entry is an SVNWCEntry, and -setEntry: looks like this:

- (void) setEntry:(SVNWCEntry *)value
{
	[self willChangeValueForKey:@"entry"];

	[value retain];
	[entry release];
	entry = value;

	[self didChangeValueForKey:@"entry"];
}

I can see how this could lead to some vigorous unregistering of observers.

will/didChanging @"entry.kind" in setEntry makes no discernible difference.

"kind" is a property of SVNWCEntry, and the purpose of the SVNInfoUI is to display all those SVNWCEntry properties, including "kind", so I dare say someone's observing the thing, but I can't trace down who, or where the connection's made, or how to unmake it. Kind is not a member variable, it's an entry in a dictionary held by SVNWCEntry, so - [SVNWCEntry kind] is actually

- (NSString *) kind {
	return [data valueForKey:@"kind"];
}

which I believe is still KVC-compliant and KVOable, though I'm mystified as to why it was originally coded that way.

And yes, I've been changing all that code furiously, in particular because all these objects were formerly leaked and I'm trying to get them released and cleaned up, and so even though this stuff has been in our product for a long time, this is probably the first time on any stage that an SVNInfoUI and its associated SVNWCEntry have ever actually been dealloc'ed, so nearly any surprising thing might be true of them.


-==- Jack Repenning email@hidden Project Owner SCPlugin http://scplugin.tigris.org "Subversion for the rest of OS X"


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Need a native guide through "Cannot remove an observer" woods
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Saving NSTextView data to CoreData without ending editing
  • Next by Date: Re: how to manage multiple non-document windows
  • Previous by thread: [Moderator] Re: iphone document syncing
  • Next by thread: Re: Need a native guide through "Cannot remove an observer" woods
  • Index(es):
    • Date
    • Thread