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

Reply via email to