viewWillMoveToWindow, garbage collected apps, finalize, and resurrection errors
viewWillMoveToWindow, garbage collected apps, finalize, and resurrection errors
- Subject: viewWillMoveToWindow, garbage collected apps, finalize, and resurrection errors
- From: "Sean McBride" <email@hidden>
- Date: Fri, 22 May 2009 15:05:04 -0400
- Organization: Rogue Research Inc.
Hi all,
In my GC app I've just tried to use, in my custom NSView, the
viewWillMoveToWindow: method. When the window containing the view is
closed, this method is called with nil as the window parameter. That's
expected. I was surprised to see in the backtrace that this is called
when the window is finalizing:
#0 -[MyView viewWillMoveToWindow:] (self=0x800427ec0,
_cmd=0x7fff8293c9b8, inNewWindow=0x0)
#1 0x00007fff813dcfc6 in -[NSView _setWindow:] ()
#2 0x00007fff8000bc18 in CFArrayApplyFunction ()
#3 0x00007fff813dd573 in -[NSView _setWindow:] ()
#4 0x00007fff8000bc18 in CFArrayApplyFunction ()
#5 0x00007fff813dd573 in -[NSView _setWindow:] ()
#6 0x00007fff8000bc18 in CFArrayApplyFunction ()
#7 0x00007fff813dd573 in -[NSView _setWindow:] ()
#8 0x00007fff8000bc18 in CFArrayApplyFunction ()
#9 0x00007fff813dd573 in -[NSView _setWindow:] ()
#10 0x00007fff8000bc18 in CFArrayApplyFunction ()
#11 0x00007fff813dd573 in -[NSView _setWindow:] ()
#12 0x00007fff8000bc18 in CFArrayApplyFunction ()
#13 0x00007fff813dd573 in -[NSView _setWindow:] ()
#14 0x00007fff819d2bf4 in -[NSWindow finalize] ()
#15 0x00007fff828cabfd in finalizeOneObject ()
#16 0x00007fff80c56fe0 in foreach_block_do ()
#17 0x00007fff828cad0e in batchFinalize ()
#18 0x00007fff828cadde in batchFinalizeOnMainThread ()
... etc. ...
This appears to constrain what I can do in the method. I am getting
resurrection errors if I try to send, for example, [self
infoForBinding:] to my view:
- (void)viewWillMoveToWindow:(NSWindow*)inNewWindow
{
[super viewWillMoveToWindow:inNewWindow];
if (inNewWindow == nil)
{
(void)[self infoForBinding:@"foo"]; // poof!
}
}
What can and cannot be done safely in this method? The docs say only
"Subclasses can override this method to perform whatever actions are
necessary." :(
Thanks,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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