[R-SIG-Mac] R GUI and Quartz

Randy Lai randy.cs.lai at gmail.com
Thu Nov 14 00:36:45 CET 2013


I found a better solution which works in ARC mode

- (void)windowWillCloseNotifications:(NSNotification*) aNotification
{
    NSWindow* w = [aNotification object];

    if (w && [[(NSObject*)[w delegate] className] isEqualToString:@"QuartzCocoaView"]){
        [w setReleasedWhenClosed:NO];
    }

On Nov 13, 2013, at 2:28 PM, Randy Lai <randy.cs.lai at gmail.com> wrote:

> an additional semi colon is the last post.
> 
> - (void)windowWillCloseNotifications:(NSNotification*) aNotification
> {
> 
> 	NSWindow *w = [aNotification object];
> 
>    if (w && [[(NSObject*)[w delegate] className] isEqualToString:@"QuartzCocoaView"])
>         [w retain];
> 
> On Nov 13, 2013, at 2:10 PM, Randy Lai <randy.cs.lai at gmail.com> wrote:
> 
>> I figured it out. The window instance will be released in the main R, so we have to retain the instance until it is released.
>> Otherwise, the window will be released twice.
>> 
>> - (void)windowWillCloseNotifications:(NSNotification*) aNotification
>> {
>> 
>> 	NSWindow *w = [aNotification object];
>> 
>>   if (w && [[(NSObject*)[w delegate] className] isEqualToString:@"QuartzCocoaView"]);
>>        [w retain];
>> 
>> 
>> On Nov 13, 2013, at 12:07 PM, Randy Lai <randy.cs.lai at gmail.com> wrote:
>> 
>>> I meant the method windowWillCloseNotifications in RDocumentController.m
>>> 
>>> 1. change “QuartzCocoaView” to something otherwise to avoid it being invoked,
>>> 2. compile the R GUI
>>> 3. run the plot function, e.g. plot(1,1)
>>> 4. close the quartz
>>> 
>>> you will see the error  EXC_HAD_ACCESS (code=EXC_i386_GPFLT).
>>> 
>>> there may be a memory leak in R code!?
>>> 
>>> 
>>> On Nov 13, 2013, at 6:26 AM, Simon Urbanek <simon.urbanek at r-project.org> wrote:
>>> 
>>>> On Nov 13, 2013, at 6:54 AM, Randy Lai <randy.cs.lai at gmail.com> wrote:
>>>> 
>>>>> Hi all,
>>>>> 
>>>>> I am studying the R GUI code and I have a question about Quartz.
>>>>> 
>>>>> It seems that R GUI will add a dummy Quartz Cocoa window before the quartz is closed.
>>>>> What is the reason behind?
>>>>> 
>>>> 
>>>> Can you supply some details as of what you're looking at? The GUI is no longer driving Quartz, so I'm not sure what code you have in mind.
>>>> 
>>>> Cheers,
>>>> Simon
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> I have tried compiled the code without this part, it raises an error for EXC_HAD_ACCESS (code=EXC_i386_GPFLT).
>>>>> 
>>>>> Randy
>>>>> _______________________________________________
>>>>> R-SIG-Mac mailing list
>>>>> R-SIG-Mac at r-project.org
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>> 
>>>> 
>>> 
>> 
> 



More information about the R-SIG-Mac mailing list