Re: How do I debug weak_unregister_no_lock?
Re: How do I debug weak_unregister_no_lock?
- Subject: Re: How do I debug weak_unregister_no_lock?
- From: Quincey Morris <email@hidden>
- Date: Tue, 14 Jan 2014 21:05:51 -0800
On Jan 14, 2014, at 18:34 , Gideon King <email@hidden> wrote:
> Although it is always happening at the same point in the code, I really have no idea where to look for debugging it.
I have no answers, but a couple of observations.
First, you seem to be crashing in the dealloc (or destructor, if it’s a C++ class) of class OUIInspectorPane. I’d suggest you focus on properties of that class whose value is a weak object reference.
Second, I’ve noticed some very surprising behavior with weak references at dealloc time. If an object being deallocated has a weak reference to another object, and it was the only reference so that the other object is also due to be deallocated, then (IIRC) the weak reference variable isn’t nil — and the referenced object’s dealloc hasn’t run yet — but you can’t send a message to the object via the weak reference because it’s marked as being in deallocation. Something like that.
I wish I remember the circumstances more clearly, but the takeaway was that it’s unsafe to try to clean up objects referred to via weak references *at the referrer’s dealloc time*. You might have to change it to a strong reference (and break the reference cycle somewhere), or do the cleanup before you get to the referrer’s dealloc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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:
This email sent to email@hidden