• 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: crash when using notification center and self
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crash when using notification center and self


  • Subject: Re: crash when using notification center and self
  • From: j o a r <email@hidden>
  • Date: Tue, 6 Jun 2006 18:10:44 +0200


On 6 jun 2006, at 17.56, Bill Bumgarner wrote:

[[NSNotificationCenter defaultCenter]
postNotificationName:@"MBModelStateChanged" object:self
userInfo:info];

results in a SIGSEGV

My model is going to post notifications which the controller picks up
- I'm calling that code from the model and I have multiple models so I
need to be able to pay attention to only the right one at the right
time.


Is it wrong to pass "self" as the object when posting a notification?

Nope -- self works fine. The 'object:' parameter is used to only notify observers of that specific object for that specific notification (or observers that are interested in all instances of the notification).


Likely, you have registered an observer that was observing just notifications to 'self' that was released without first being removed from the notification center as an observer.

The notification center does not retain observers and, therefore, if an observer is released without first being removed as an observer from the notification center, you'll see crashes just like this.

...and using NSZombieEnabled is probably the most effective way to track down where the problem is.


j o a r


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >crash when using notification center and self (From: "Tyler Riddle" <email@hidden>)
 >Re: crash when using notification center and self (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Drive mounting problem
  • Next by Date: Re: Java VM version
  • Previous by thread: Re: crash when using notification center and self
  • Next by thread: Re: crash when using notification center and self
  • Index(es):
    • Date
    • Thread