FROM : j o a r
DATE : Sun Nov 28 15:15:25 2004
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
DATE : Sun Nov 28 15:15:25 2004
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
| Related mails | Author | Date |
|---|---|---|
| Peter Browne | Nov 28, 13:09 | |
| j o a r | Nov 28, 15:15 |






Cocoa mail archive

