Re: ARC
Re: ARC
- Subject: Re: ARC
- From: "Gary L. Wade via Cocoa-dev" <email@hidden>
- Date: Sat, 24 Aug 2019 11:10:15 -0700
Sometimes the best approach when something seems magical or extremely
unexpected is to step away to the marker board and draw pictures and a “movie”
storyboard of what’s going on, tallying up visually everything. Unilaterally
using strong or weak references is not the answer. Often when I go through that
exercise, without cutting corners or assuming stuff, a solution usually
presents itself.
--
Gary L. Wade
http://www.garywade.com/
> On Aug 24, 2019, at 4:44 AM, Turtle Creek Software via Cocoa-dev
> <email@hidden> wrote:
>
> Our app delegate class is not deallocated. The window controller is
> deallocated
> despite the member reference there. If we keep the second strong reference
> to the controller,
> then the outline view is deallocated instead. Nothing references the view
> except being in the .xib file for the window controller.
>
> We had similar problems with a NSTabViewer. When we futzed the build
> settings to allow
> breakpoints on retain and release, it was being retained 34 times and
> released 35 times-
> all inside Apple code. The only way we found to fix that was to stop using
> a NSTabViewController
> and just manage it directly.
>
>> On Fri, Aug 23, 2019 at 8:27 PM Jens Alfke <email@hidden> wrote:
>>
>>
>>
>> On Aug 23, 2019, at 2:17 PM, Casey McDermott via Cocoa-dev <
>> email@hidden> wrote:
>>
>> After we finished, the controller for our main window started being
>> deallocated some random time after launch.
>> Apparently the erroneous strong references were keeping it alive.
>>
>>
>> AppKit delegates, like NSWindow.delegate, are unsafe-unretained
>> references; this might be giving you trouble.
>>
>> We allocate the controller in our app delegate class. It's a member but
>> apparently that is not a
>> strong enough reference, so the controller is released at the end of the
>> scope.
>>
>>
>> A member variable is a strong reference by default, so that should suffice
>> to keep it alive. Is your app delegate itself being dealloced?
>>
>> —Jens
>>
_______________________________________________
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
References: | |
| >ARC (From: Casey McDermott via Cocoa-dev <email@hidden>) |
| >Re: ARC (From: Jens Alfke via Cocoa-dev <email@hidden>) |
| >Re: ARC (From: Turtle Creek Software via Cocoa-dev <email@hidden>) |