ARC Release too soon
ARC Release too soon
- Subject: ARC Release too soon
- From: Chris Paveglio <email@hidden>
- Date: Sat, 16 Mar 2013 11:16:07 -0700 (PDT)
I'm working with ARC for the first time just now. I'm running into an issue where ARC is releasing objects too soon and I am not sure the best way to fix it. Under GC it works correctly, even in the same project if I turn off ARC and turn GC back on.
I have an AppDelegate that will spawn any number of windows. In the primary window, the user enters some fields, then presses the button that generates a new window (one of 2 different classes depending on input). The new window controller is initialized and then the values are passed to the new window controller which does the real work. But I don't have any method in the AppDelegate to keep track of the spawned windows. There is not really any reason to IMO, because they never reference anything back to the initial window. I am not declaring an app-wide variable in AppDelegate for any window controllers, nor putting the new window controllers into an array or anything. The new window data can't be saved, it's display once and done (I am not using a normal document-based application template).
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?
Thanks, Chris
_______________________________________________
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