From P.Dalgaard at biostat.ku.dk  Tue Oct  9 20:52:53 2007
From: P.Dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Tue, 09 Oct 2007 20:52:53 +0200
Subject: [Rd] misbehaviour of some tk windows, R 2.6.0 on SUSE 10.1?
In-Reply-To: <200710091248.12073.d.firth@warwick.ac.uk>
References: <200710091248.12073.d.firth@warwick.ac.uk>
Message-ID: <470BCE05.9070109@biostat.ku.dk>

David Firth wrote:
> I don't know whether this is specific to (my installation 
> of) SUSE 10.1, or is more general.  
>
> With R 2.6.0, I am finding that some widgets made through 
> the tcltk package are having problems which become evident 
> through scrollbar activity.  An example is demo(tkfaq) -- 
> see below.  To reproduce the problem, I do the following: 
> after the tk window appears, hold down the "scroll-down" 
> tab at the foot of the window for a few seconds, then 
> release.  If scrolling stops (as it should, if all is 
> working correctly), do the same thing again.  Repeating 
> this 2 or 3 times usually results in uncontrolled 
> (unstoppable) scrolling activity; and closing the window 
> when that happens delivers the errors that appear in the 
> transcript below.
>
> My R 2.6.0 was built on my own system,
>
> OS:  SUSE linux 10.1
> tcl: 8.4.12-14
> tk:  8.4.12-14
> gcc: 4.1.0-25
>
> Since I had not seen this behaviour with previous versions 
> of R, I did a check with R 2.5.1: a fresh build today of R 
> 2.5.1 on the same system does not appear to have the same 
> problem.
>
> Any ideas?  Is anyone else seeing this behaviour?
>
> David
>   

Looks a bit nasty. I see it on SUSE 10.2 as well. Increasing the
repeatinterval setting for the scrollbar helps, but even at a setting of
50, I still see the effect. It is usually stoppable with the middle
button over the trough.
The error message is what you'd expect from killing a window while
something is trying to talk to widgets inside of it. The details of the
popup dialog is a little more informative:

    while executing
"$w cget -repeatinterval"
    (procedure "tk::ScrollSelect" line 12)
    invoked from within
"tk::ScrollSelect .3.2 arrow2 again"
    ("after" script)

I think there's a clue in there. It has the hallmarks of a race
condition: As I understand it the autorepeat feature runs an "after"
script which effectively presses the arrow again 5 ms later, invoking
another "after" script, etc. A button release is supposed to kill the
after script, but it might not do so in time, in which case it may try
to kill something that already died, etc.

Can't offhand see that we did anything to the event loop that could
cause this, though.
>
> ----------------------------------------
> david at blackbox2:~> R --vanilla
>
> R version 2.6.0 (2007-10-03)
> Copyright (C) 2007 The R Foundation for Statistical 
> Computing
> ISBN 3-900051-07-0
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
>   
>> sessionInfo()
>>     
> R version 2.6.0 (2007-10-03) 
> i686-pc-linux-gnu 
>
> locale:
> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  
> methods   base     
>
> loaded via a namespace (and not attached):
> [1] rcompgen_0.1-15
>   
>> library(tcltk)
>>     
> Loading Tcl/Tk interface ... done
>   
>> demo(tkfaq)
>>     
>
>
> 	demo(tkfaq)
> 	---- ~~~~~
>
> Type  <Return>	 to start : 
>
>   
>> require(tcltk) || stop("tcltk support is absent")
>>     
> [1] TRUE
>
>   
>> local({
>>     
> + 
> +     tt <- tktoplevel()
> +     tkwm.title(tt, "R FAQ")
> + #    Gave tiny font on some systems
> + #    txt <- tktext(tt, bg="white", font="courier")
> +     txt <- tktext(tt, bg="white")
> +     scr <- tkscrollbar(tt, repeatinterval=5,
> +        .... [TRUNCATED] 
> ******************************************************
>  The source for this demo can be found in the file:
>  /home/david/lib/R/library/tcltk/demo/tkfaq.R 
> ******************************************************
>   
>> Error in structure(.External("dotTclObjv", objv, PACKAGE 
>>     
> = "tcltk"), class = "tclObj") : 
>   [tcl] invalid command name ".1.1".
>
> Error in structure(.External("dotTclObjv", objv, PACKAGE 
> = "tcltk"), class = "tclObj") : 
>   [tcl] invalid command name ".1.2".
>
> Error in structure(.External("dotTclObjv", objv, PACKAGE 
> = "tcltk"), class = "tclObj") : 
>   [tcl] invalid command name ".1.2".
>
> Error in structure(.External("dotTclObjv", objv, PACKAGE 
> = "tcltk"), class = "tclObj") : 
>   [tcl] invalid command name ".1.2".
>
> Error in structure(.External("dotTclObjv", objv, PACKAGE 
> = "tcltk"), class = "tclObj") : 
>   [tcl] invalid command name ".1.2".
>
> Error in structure(.External("dotTclObjv", objv, PACKAGE 
> = "tcltk"), class = "tclObj") : 
>   [tcl] invalid command name ".1.2".
>
>   
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>   


-- 
   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



[Rd] misbehaviour of some tk windows, R 2.6.0 on SUSE 10.1?
Peter Dalgaard