Bug 15150 - tcltk freezing using MS Windows for R-2.14+
tcltk freezing using MS Windows for R-2.14+
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Windows GUI / Window specific
R 2.15.2
All Windows 64-bit
: P3 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-21 00:31 UTC by Keith Satterley
Modified: 2012-12-24 18:05 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Satterley 2012-12-21 00:31:29 UTC
Some tcltk windows created by the code below cannot be closed by clicking the cross in the top right corner. They can be closed by right clicking in the appropriate icon in the taskbar at the bottom and selecting "Close window".

I have major problems with my affylmGUI and limmaGUI packages and Raffaele Calogero also has problems with his oneChannelGUI program. Milan Bouchet-Valay and Mark.Bravington on the R-devel mailing list that they  have experienced a similar problem. Windows users cannot currently use these packages effectively. I think if the above problem can be solved my main issues will be also solved.

To see the problem, paste the following code into an RGui window on an MS Windows computer.

k<-20
j<-0.1
test3GUI <- function(){
    require(tcltk)
    MainWindow <- tktoplevel()
    #Sys.sleep(j)
    topMenu <- tkmenu(MainWindow)
    tkconfigure(MainWindow,menu=topMenu)
    tkgrab.set(MainWindow)
    tkfocus(MainWindow)
}
for (i in 1:k) {test3GUI()}

With the Sys.sleep command commented out, usually 6 or 7 of the 20 windows created will not close with a mouse click in the top right corner. With the Sys.sleep command included all windows can be closed.

I have have had this problem on Windows XP (32bit) and Windows 7 (64 bit) using R-2.14.0, R-2.15.x and R Under development (unstable) (2012-11-16 r61126). There were no problems with R-2.13.1 and R-2.13.0 on both Windows platforms tested. There have been no problems on Mac OSX (R-2.15.x) and Linux (R-2.15.x).

I have run it using debug("GetNMethod"). Stepping through the GetNMethod function results in freezing when asked to do the "tkgrab.set(GNMethod)" instruction.

I am implimenting the Sys.sleep command in my packages (not complete yet) but I would hope there maybe a better solution. I did find that if I lowered the sleep time to 0.0001 seconds the proble resturned. Values of 0.01 and 0.001 avoided any problems on the platforms I tested.

Hope you can help,

Keith Satterley
Comment 1 Duncan Murdoch 2012-12-21 02:59:37 UTC
I see the bug.  Debugging things like this is really hard; I'm unlikely to be able to work on it in the next few months, so a patch from you would be appreciated.  

I reduced it from "blocker" severity to "normal", since you already have a workaround.
Comment 2 Duncan Murdoch 2012-12-24 18:05:41 UTC
I've applied a minimal patch to tktoplevel() that should fix this.  It may still show up in other places; if so, please follow up here.

The patch is in R-devel revision 61413.