On 04/08/2020 8:02 p.m., Simon Urbanek wrote:
Duncan,
how is quartz() related to rgl? I thought that now you only supported X11 which
wouldn't involve quartz. In general, Cocoa windows are asynchronous, i.e. when
the quartz device is created the window may not exist yet, but I'm not sure why
that would affect rgl (quartz device draws to off-screen buffer so it doesn't
mind if the windows doesn't exist yet). For the X11 device there could be
significant delay with X11 (not related to quartz) if you don't have X11
running yet as users have typically DISPLAY set to a socket which will first
start XQuartz if it's not up yet.
The only connections I know between rgl and quartz() are this bug, and
the fact that XQuartz uses Quartz.
When I see the crash, what happens is that the library(rgl) starts
XQuartz. Running quartz() at this point opens a window with no crash
(but it's a little slower than I'd expect). Running plot(1:10) after
that causes no problems.
However, if I skip calling quartz() explicitly as in the demo code
below, the plot(1:10) call will call it and plot immediately, and that
usually causes the crash.
Duncan
Cheers,
Simon
On 5/08/2020, at 8:51 AM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote:
I seem to have a workaround for the rgl-related crash. If I insert a one
second delay after the first quartz() device is opened but before anything is
plotted, then I don't see the crash. This script does that if the RGL_SLOW_DEV
environment variable is non-empty:
if (nchar(Sys.getenv("RGL_SLOW_DEV")))
options(device = local({
olddev <- getOption("device")
function(...) {
olddev(...)
Sys.sleep(1)
options(device = olddev)
}
}))
library(rgl)
plot(1:10)
The last two lines are the code to trigger a crash. I'm seeing pretty regular
crashes if I source this without RGL_SLOW_DEV being set, but setting it seems
to make things work. I tried reducing the delay to 0.1 seconds and it didn't
work.
I'd hypothesize that what's happening is that some part of the initialization
of the quartz() window is asynchronous with the main R thread, and in Catalina
something about rgl makes it so slow that the window isn't ready when R starts
plotting there. But I don't know the quartz() device code, so this might not
be right at all.
Duncan Murdoch
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac