Re: ARC Release too soon
Re: ARC Release too soon
- Subject: Re: ARC Release too soon
- From: Kevin Muldoon <email@hidden>
- Date: Sat, 16 Mar 2013 17:52:24 -0400
I'd think adding the WindowController to a @property (strong, nonatomic) NSArray *array; would keep those objects alive. Most often, I would simply add each WindowController (or in my case, ViewController) one-at-a-time in the .h. I simply feel it's clearer to see.
@property (strong, nonatomic) RJLarryViewController *larryViewController;
@property (strong, nonatomic) RJCurleyViewController *curleyViewController;
@property (strong, nonatomic) RJMoeViewController *moeViewController;
On Mar 16, 2013, at 5:38 PM, Chris Paveglio <email@hidden> wrote:
> Sure I totally understand that. My question is more of "what is the most elegant way to do it". Add them to an array?
>
>
> ----- Original Message -----
> From: iain <email@hidden>
> To: Chris Paveglio <email@hidden>
> Cc: Cocoa Dev List <email@hidden>
> Sent: Saturday, March 16, 2013 2:35 PM
> Subject: Re: ARC Release too soon
>
>
>
> On 16 Mar 2013, at 06:16 PM, Chris Paveglio <email@hidden> wrote:
>
>> So, am I doing some fundamental window management wrong (not sure since old app worked OK and didn't seem to leak), or how do I do something so ARC doesn't dealloc window controllers at the end of the function that fires them off
>
> If you want the window controllers to hang around after the function finished you need to assign them to a strong variable otherwise they will be released.
>
> Iain
> _______________________________________________
>
> 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
_______________________________________________
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