I maintain a package that uses Rcpp to call OpenCV which then does some image processing and displays the results using OpenCVs high-level GUI (which uses cocoa on macOS https://github.com/opencv/opencv/blob/master/modules/highgui/CMakeLists.txt).
Lately everytime Apple releases a new version users that use R through Rstudio have been reporting crashes when high-level GUI windows are closed by OpenCV (using cv::destroyAllWindows(); from OpenCV C++). This issue is usually resolved by installing Rstudio daily build which is compiled with latest release of macOS.
The issue never happens if the same R code is executed through R from the terminal.
Another observation I've seen that is specific to running OpenCV C++ code from Rstudio is that windows that are closed by cv::destroyWindow() or cv::destroyAllWindows() will be made inactive but still open whereas running R from the terminal the windows will close.
Any advice or suggestion on how I can avoid telling users of the package to upgrade Rstudio to daily build everytime they upgrade macOS?