> On Dec 6, 2016, at 1:33 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> wrote:
> 
>> On Dec 6, 2016, at 1:24 PM, David Duncan <david.dun...@apple.com> wrote:
>> 
>> Your safest bets are to either clear the delegate of the layer at an 
>> appropriate time (possibly in your view controller’s dealloc is all that is 
>> necessary), or to use a UIView instead of a raw CALayer in this case. 
>> Removing the layer would also suffice, as that would prevent UIKit from 
>> seeing it at the time in question. Making the layer weak is probably causing 
>> your reference to deallocate before it can be added to the layer tree, which 
>> is why it doesn’t display in that case.
> 
> Thanks for this explanation, David! 
> 
> I've verified that using either of:
>    [self.layer setDelegate:nil];
> or
>    [self.layer removeFromSuperlayer];
> will prevent the crash. 

Followup: It turns out that the 'offending' line of code is:

  [self.layer setDelegate:self];

If I don't set this, everything still works correctly, and there's no crash at 
dealloc time.

-Carl


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to