• 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
Re: Get error message about registered observers when Object receives dealloc message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get error message about registered observers when Object receives dealloc message


  • Subject: Re: Get error message about registered observers when Object receives dealloc message
  • From: Reinhard Segeler <email@hidden>
  • Date: Fri, 28 Aug 2009 17:08:07 +0200

It simply tells you, that if you have removed observation for an instance of your class MYObservee somewhere in your code, so it can't remove observation again. I would try remove observation for the mentioned key path only, just to see if happens with that again. That's what I read from the message.

Reinhard
Am 28.08.2009 um 15:56 schrieb Andreas Grosam:

I'm using key-value-observing where an instance of class MyObservee has been registered for KVO with other objects which observe a value in a key path (e.g.: @"drives.model.port"):

The observee itself unregisters all observers in its dealloc method:

@implementation MyObservee
- (void) dealloc
{
[self removeAllObservers]; // basicly: [self removeObserver:observer forKeyPath:key];


   [super dealloc];
}


The observers are sill alive when the observee receives its dealloc message.


When the observed instance receives its dealloc message, I'm getting this error message in the console, before the first line of code in the dealloc method will be executed (note: BEFORE [super deallocate] has been invoked):


2009-08-28 14:57:49.753 MyApp[886:20b] An instance 0xd21b60 of class MyObservee is being deallocated while key value observers are still registered with it. Observation info is being leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0xd38e00> (
<NSKeyValueObservance 0xd39880: Observer: 0xd356e0, Key path: drives.model.port, Options: <New: NO, Old: NO, Prior: NO> Context: 0x16df0, Property: 0xd38990>
...



The class MyObservee does NOT have a sub class - that is, [super dealloc] will not be called somewhere prematurely.
The base class of MyObservee is NSObject.



Am I doing something wrong here?

Thanks in advance for hints.


Regards Andreas Grosam _______________________________________________

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

_______________________________________________

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


References: 
 >Get error message about registered observers when Object receives dealloc message (From: Andreas Grosam <email@hidden>)

  • Prev by Date: Re: Snow Leopard SDK for non "Premier" or "Select" ADC members
  • Next by Date: Re: Starting editing for a Row as soon as it is Added.
  • Previous by thread: Get error message about registered observers when Object receives dealloc message
  • Next by thread: Re: Get error message about registered observers when Object receives dealloc message
  • Index(es):
    • Date
    • Thread