Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notifications



On Mar 3, 2007, at 7:55 PM, Tim Horton wrote:

I'm working on a video player application, and I'm having some trouble with my QTMovieDidEndNotification.

Once in a while, it will randomly start throwing a EXEC_BAD_ACCESS from 'CallActionNotifications'... recompile, and it may or may not happen.

Does anyone know why this might happen?

If you run your software with NSZombieEnabled (from <Foundation/ NSDebug.h>) set to YES, instead of crashing, does it tell you that a deallocated object is being messaged?


When an object is deallocated, it is not automatically removed as an observer of any notifications. You need to do this in its class's override of -dealloc:

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];

    // anything else you need to release in -dealloc

    [super dealloc];
}

Obviously you also need to ensure that whatever object is acting as an observer isn't being deallocated accidentally, e.g. because it's been over-released.

  -- Chris

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Notifications (From: Tim Horton <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.