[R-SIG-Mac] (no subject)
Simon Urbanek
simon.urbanek at r-project.org
Fri Mar 23 14:47:37 CET 2007
Gorazd,
thanks for the suggestion. Unfortunately it doesn't solve the
problem. There are two reasons:
1) the myWinCtrl is not a local variable, it is an instance variable
and as such RDocument manages its lifetime and therefore it is
properly released in -(void)close. (note
[self removeWindowController:myWinCtrl];
[myWinCtrl close];
just before the hack and
[myWinCtrl release];
myWinCtrl=nil;
just after the hack.
2) even if we release myWinCtrl right away (albeit incorrectly so)
the problem persists
I agree that there is something wrong, I just don't know what - the
symptom is that the corresponding entry in the "Window" menu stays
there and you can click on it and open the document again. So the
hack fixes the symptom, but likely not the cause. If you have an idea
what could cause the entry to stay in the list even though the window
is closed, please let me know.
Thanks,
Simon
On Mar 16, 2007, at 10:11 AM, Gorazd Krosl wrote:
> I downloaded the R for mac sources and was browsing through the code
> of RDocument. In - (void)close method I noticed comment:
> // --- something is broken - winctrl close doesn't work - I have no
> idea why - this is a horrible hack to cover up
>
> I think I found why, in the method - (void) makeWindowControllers the
> window controller for document is allocated and added to the document
> but <<never>> released. The document <<retains>> window controller so
> the code should read something like that:
>
> myWinCtrl = [[RDocumentWinCtrl alloc]
> initWithWindowNibName:@"RDocument"];
> [self addWindowController:myWinCtrl];
> [myWinCtrl release];
>
> Now window controller will be correctly released on document close
> and will also correctly release the nib's top level objects.
>
> Hope this will help,
> Gorazd
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>
More information about the R-SIG-Mac
mailing list