Re: ARC

2019-08-23 Thread Roland King via Cocoa-dev
> > BTW, one site we looked at describes ARC as "kind of like a Japanese B-horror > movie". That seems accurate. > I don’t know what site wrote that but it couldn’t be less accurate. ARC is one of the better pieces of technology Apple introduced into Objective-C and it cut down on a huge num

Re: ARC

2019-08-23 Thread Jens Alfke via Cocoa-dev
> On Aug 23, 2019, at 2:17 PM, Casey McDermott via Cocoa-dev > 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.deleg

Re: ARC

2019-08-23 Thread Turtle Creek Software via Cocoa-dev
Sorry, it's a Mac app, written in Objective-C and C++. We checked the Memory Graph and nothing seemed amiss. On Fri, Aug 23, 2019 at 6:51 PM Alex Zavatone wrote: > Casey, it it’s an iOS app, read up on strong and weak and use the > storyboard to breat your first screen. > > Assuming it’s an iOS

Re: ARC

2019-08-23 Thread Alex Zavatone via Cocoa-dev
Casey, it it’s an iOS app, read up on strong and weak and use the storyboard to breat your first screen. Assuming it’s an iOS app… Why are you allocating the controller in the app delegate? Are you embedding it in a Nav controller? ARC is fantastic. The view controller is within the wi

Re: ARC

2019-08-23 Thread Ben Kennedy via Cocoa-dev
> On 23 Aug 2019, at 2:17 pm, Casey McDermott via Cocoa-dev > wrote: > > 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. What is best practice to hold a stron

Re: ARC

2019-08-23 Thread Alex Zavatone via Cocoa-dev
Casey, is this a Mac app or an iOS app? > On Aug 23, 2019, at 4:17 PM, Casey McDermott via Cocoa-dev > wrote: > > We allocate the controller in our app delegate class ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

ARC

2019-08-23 Thread Casey McDermott via Cocoa-dev
We started out assuming that ARC was like Python or Java, where you could just allocate objects and it would manage their lifetimes automatically. Then we read about the complexities of ARC, and started adding __weak to upstream references. After we finished, the controller for our main window