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: Kyle Sluder <email@hidden>
- Date: Tue, 14 Jan 2014 23:56:48 -0800
On Jan 14, 2014, at 9:05 PM, Quincey Morris <email@hidden> wrote:
>
>> 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.
Gah. We tried _so hard_ to find this bug before shipping our iOS 7 apps. We still have no idea what causes it, but it always seems to happen in the ARC-generated autodestructor of an OUIInspectorPane.
Can you describe the contents of your inspectors? For a while we had a hunch it involved some OmniOutliner-specific piece of UI.
>
> 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.
We shouldn't be doing any of this, but I'll forward this message up the chain.
Thanks for all the help.
--Kyle Sluder
_______________________________________________
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