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 protected]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to