Re: crash when using notification center and self
Re: crash when using notification center and self
- Subject: Re: crash when using notification center and self
- From: Bill Bumgarner <email@hidden>
- Date: Tue, 6 Jun 2006 08:56:58 -0700
On Jun 5, 2006, at 11:01 PM, Tyler Riddle 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.
b.bum
_______________________________________________
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