• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do I debug weak_unregister_no_lock?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I debug weak_unregister_no_lock?


  • Subject: Re: How do I debug weak_unregister_no_lock?
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 15 Jan 2014 02:23:23 -0600

On Jan 15, 2014, at 1:56 AM, Kyle Sluder wrote:

> On Jan 14, 2014, at 9:05 PM, Quincey Morris <email@hidden> wrote:
>>
>> 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 […]

That doesn't make sense.  A weak reference can't be the only reference to an object.  As I'm sure you know, objects are deallocated (and weak references nil'd) when the last *strong* reference is broken.

Whatever the mysterious behavior is, I don't think it can be that.

I suppose it could be that the object has a weak reference to itself and that could cause some sort of problem if a message were sent through that weak reference during -dealloc.  I would expect that having a weak reference to self would be fairly common and that ARC would have to cope properly.

Since the original crash was an access violation inside the runtime, I would suspect a memory smashing bug prior to the destruction of the OUIInspectorPane subclass instance.  When ARC goes to unregister that instance's weak reference, it steps on a land mine that was laid previously.  Since the crash seems not to happen at random, I guess the memory smashing was done shortly before this.  (It's certainly possible for a corrupted data structure to not influence anything until a long time after the corruption has happened, but in that situation the crash is more likely to affect random other code.)  So, I'd suspect the -dealloc of the OUIInspectorPane subclass, prior to the implicit call of super's -dealloc.  Or the code which does the final release of that object which provokes the deallocation.

Regards,
Ken


_______________________________________________

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


  • Follow-Ups:
    • Re: How do I debug weak_unregister_no_lock?
      • From: Quincey Morris <email@hidden>
    • Re: How do I debug weak_unregister_no_lock?
      • From: Gideon King <email@hidden>
References: 
 >How do I debug weak_unregister_no_lock? (From: Gideon King <email@hidden>)
 >Re: How do I debug weak_unregister_no_lock? (From: Gideon King <email@hidden>)
 >Re: How do I debug weak_unregister_no_lock? (From: Quincey Morris <email@hidden>)
 >Re: How do I debug weak_unregister_no_lock? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: How do I debug weak_unregister_no_lock?
  • Next by Date: Re: How do I debug weak_unregister_no_lock?
  • Previous by thread: Re: How do I debug weak_unregister_no_lock?
  • Next by thread: Re: How do I debug weak_unregister_no_lock?
  • Index(es):
    • Date
    • Thread