Bug 15253 - "identify" causes R to hang if a plot window is closed
"identify" causes R to hang if a plot window is closed
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Graphics
R 3.0.0
x86_64/x64/amd64 (64-bit) Linux
: P5 major
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-03 18:16 UTC by Simon Anders
Modified: 2013-08-25 11:27 UTC (History)
1 user (show)

See Also:


Attachments
Proposed patch which fixes issue in both identify and locator (1.35 KB, patch)
2013-08-18 01:35 UTC, Gabriel Becker
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Anders 2013-04-03 18:16:19 UTC
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
   plot(1:5,1:5)

   # open a second window
   x11()

   # plot something in it
   plot(1:5,1:5)

   # use identify on it
   identify(1:5,1:5)

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 
  plot(1:5,1:5)
  identify(1:5,1:5)
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
Comment 1 Gabriel Becker 2013-08-18 01:35:09 UTC
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.