Re: Problem with bindings and cleaning up a view
Re: Problem with bindings and cleaning up a view
- Subject: Re: Problem with bindings and cleaning up a view
- From: Keary Suska <email@hidden>
- Date: Thu, 28 Jun 2007 10:23:56 -0600
- Thread-topic: Problem with bindings and cleaning up a view
on 6/28/07 9:53 AM, email@hidden purportedly said:
> I can't just release the controller since that will do nothing since
> the window etc all have retained objects from the NIB and the array
> controller retains me too. So, instead I have written a "detach"
> method that goes through and removes my view from its superview and
> releases all the top level items from the nib.
>
> The problem I am getting is when the autorelease pool does its thing
> I get a crash in a bindings related call:
> "NSKeyValueObservationInfoCreateByRemoving"
This may or may not help, but I have experienced problems with loaded nibs
when nib objects bind to or through the nib owner. Because objects "unbind"
in dealloc, you have to make sure in these cases that the top level objects
are dealloced *before* the nib owner (or any other object outside the nib
they are bound to) is dealloced. Because the nib loading routines
autorelease top level objects, the autorelease pool needs to be cleared
first. I do this by calling:
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate
dateWithTimeIntervalSinceNow:0.1]];
Works like a charm.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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