• 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 after an NSNotification is posted
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash after an NSNotification is posted


  • Subject: Re: Crash after an NSNotification is posted
  • From: j o a r <email@hidden>
  • Date: Sun, 28 Nov 2004 15:15:25 +0100


On 2004-11-28, at 13.09, Peter Browne wrote:

I have an application that on startup runs through a mock 'loading' animation. When the animation finishes, an NSNotification is posted alerting those classes that need to know. Equally, when the user chooses 'Quit' an animation sequence runs through before the application actually terminates. If the user chooses quit BEFORE the loading animation has finished (and therefore before the notification has been posted), then everything works fine.. the loading animation stops, and the shutdown animation begins. But if the user chooses 'quit' AFTER the loading animation has finished and the notification been posted, the program suddenly quits with signal 10 (SIGBUS). I can only assume the problem is with the notification posting, as the shutdown animation worked fine before i added the code for the notifications. The problem seems to lie in this method (the custom 'Quit' action). The first NSLog is displayed, but the program chokes before it gets to the next lot of NSLogs. Any ideas?

One of the more common problems with notifications you sign up some object for a notification, but forget to unsubscribe from receiving that notification when the object is deallocated.
The notification center will still have a pointer to the deallocated object, and this will trigger a crash when next notification to the deallocated object is being broadcasted.
Check through all your objects that sign up for notifications, and make sure that they also *always* unsubscribe at some point - usually in dealloc.


I would also suggest that you try to stick to the standard ObjC coding guidelines (method and variable names begins with lower case letters), at least for code that you post to mailing lists. It makes it much easier for others to read and understand your code.

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 after an NSNotification is posted (From: Peter Browne <email@hidden>)

  • Prev by Date: Crash after an NSNotification is posted
  • Next by Date: Re: How to bind two combo boxes with Cocoa Bindings ?
  • Previous by thread: Crash after an NSNotification is posted
  • Next by thread: Re: How to bind two combo boxes with Cocoa Bindings ?
  • Index(es):
    • Date
    • Thread