Re: Mysterious crash with NSTableView
Re: Mysterious crash with NSTableView
- Subject: Re: Mysterious crash with NSTableView
- From: "Gary L. Wade" <email@hidden>
- Date: Fri, 26 Aug 2016 10:25:27 -0700
I'm talking about exchanging release for autorelease on your list delegate, which happens after runModal finishes. Since you now do an orderOut, your table view should not need its data source/delegate, so it should be safe keeping them set and using an autorelease, but clearing them is the safest.
This kind of exercise in understanding the MRC rules is precisely why ARC was created. If you need to use MRC, you probably should do what lots of others did and draw lots of pictures in timeframes with tally counts on objects to understand what happens when. If you go with ARC, this clearing should happen for you—I'm pretty sure the data source and delegate are weak, but I don't have the headers in front of me right now.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/
> On Aug 26, 2016, at 9:38 AM, Andreas Falkenhahn <email@hidden> wrote:
>
>> On 26.08.2016 at 17:52 Gary L. Wade wrote:
>>
>> You would not see this if you hid or removed the table view first
>> since it would not need its data source or delegate then. Try going
>> with ARC or at least use autorelease on your delegate/data source.
>
> I'm not using autorelease on the delegate/data source on purpose because
> AFAIU autoreleased objects are (potentially) killed whenever the application
> is in an event loop and this is the case with runModalForWindow(). AFAIU
> if I used autorelease on the delegate/data source then both would be
> killed in the run loop started by runModalForWindow() because both setDelegate()
> and setDatasource() don't retain. So using autorelease doesn't make sense
> to me here. Is this right or did I get anything wrong here?
>
> --
> Best regards,
> Andreas Falkenhahn mailto:email@hidden
>
_______________________________________________
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