Re: NIB's owner doesn't get released because of NSArrayController
Re: NIB's owner doesn't get released because of NSArrayController
- Subject: Re: NIB's owner doesn't get released because of NSArrayController
- From: "Vitaly Ovchinnikov" <email@hidden>
- Date: Thu, 15 Jan 2009 08:58:29 +0300
Well, OK. I am ready to release all root objects myself. Just tested
with subclassed NSView from that NIB - it didn't get released
automatically.
So I added several -release calls to -dealloc method of my NIB's owner
and now it will release everything.
But the problem is still there: -dealloc of my view controller didn't
get called because array controller still retains it!
As I wrote above, I added special "killer" method that breaks binding
and after calling it I can call -release and it will call NIB owner's
-dealloc. But this is ugly...
On Thu, Jan 15, 2009 at 1:15 AM, Jason Foreman <email@hidden> wrote:
> On Wed, Jan 14, 2009 at 3:51 PM, Vitaly Ovchinnikov
> <email@hidden> wrote:
>> Hello all,
>>
>> I have a custom-loaded NIB file with NSView and NSArrayController.
>> Array controller is bound to file's owner (NSObject's derived class)
>> and use some keypath for contentArray. The problem is when I close a
>> window and main window controller tries to release this file's owner -
>> array controller still holds a reference to it and doesn't allow to do
>> that.
>>
>> So I have two questions:
>> 1. What is the correct way to catch "closing" of the view to unbound
>> array controller?
>> 2. Do I really need to catch something? Maybe there is a simpler solution?
>>
>> Any ideas?
>
> Top-level objects in a nib need to be released. You can do this in
> the File's Owner object when the window is closed, for example.
>
> See this page for some additional info on nib object memory management:
>
> http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemMgmtNibObjects.html
>
>
> Jason
> _______________________________________________
>
> 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