If several plot windows (X11 devices) are open simultaneously, closing the active plotting window while identify is waiting for mouse clicks causes R to hang.
Steps to reproduce:
# plot something
# open a second window
# plot something in it
# use identify on it
Now close the active plotting window. Afterwards, 'identify' no longer reacts to the right mouse button nor to ctrl-C, i.e., the R session hangs.
Note that the issue does not appear if only one plotting window is available:
Start with no open windows, enter
then close the plotting window, while identify is waiting for mouse clicks. R reacts, correctly, with:
Error in identify.default(1:5, 1:5) : No graphics device is active
Created attachment 1474 [details]
Proposed patch which fixes issue in both identify and locator
The issue was actually that locator was hanging, not identify.
The attached patch addresses this within GLocator in library/graphics/src/graphics.c
The change temporarily assigns a new close handler to the graphics device which performs any existing close handling tasks and then throws an informative error.
Upon successful completion of the locator functionality, the previous/standard close handler is restored.