From p.dalgaard@biostat.ku.dk  Mon Apr 22 23:12:06 2002
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 23 Apr 2002 00:12:06 +0200
Subject: [Rd] Quit R by pressing button (tcltk) (PR#1475)
In-Reply-To: <200204222121.XAA00829@pubhealth.ku.dk>
References: <200204222121.XAA00829@pubhealth.ku.dk>
Message-ID: <x2u1q34c3t.fsf@blueberry.kubism.ku.dk>

strach.joachim@web.de writes:

> Full_Name: Joachim H. Strach
> Version: 1.3.1
> OS: Windows 98 Second Edition
> Submission from: (NULL) (132.230.131.220)
> 
> 
> I am using the tcltk package.
> Error-example:
> ----
>   library(tcltk)
>   top<-tktoplevel()
>   but<-tkbutton(top,text="Quit",command=function() {q(save="no")} )
>   tkpack(but)
> ----
> then press the Quit-Button. 
> On my Platform there will be a execution fault with following message:
> ----
> RGUI verursachte einen Fehler durch eine ungltige Seite
> in Modul TK83.DLL bei 0167:11450066.
> Register:
> EAX=8187f731 CS=0167 EIP=11450066 EFLGS=00010206
> EBX=112e0000 SS=016f ESP=008dfa70 EBP=008dfa7c
> ECX=43a00000 DS=016f ESI=00000000 FS=1257
> EDX=43a00000 ES=016f EDI=00000001 GS=0000
> Bytes bei CS:EIP:
> 8b 42 08 3b 45 f8 75 0a 8b 4d f4 c7 41 08 00 00 
> Stapelwerte:
> 43a00000 0063d004 005bb094 008dfb04 114a247d 006802e4 00000000 00000000 00000000
> 008dfab4 00000011 0000026f 00000000 00611928 0063c864 0063c864 
> ----
> R will be closed, but this error message is not really nice )-;  .
> 
> That's it.

A bug report on 1.3.1, one week before 1.5.0, is a bit late don't you
think?

I cannot check Windows versions right now, but pre-1.5.0 on Linux
doesn't crash. However, it does leave the terminal in noecho mode.

Basically, just don't do that for now... q() and probably others do
not expect to be invoked from a callback. I don't think there's a nice
alternative implementation of a quit button without blocking the
console. (By waiting for a window event or tcl variable change and
then executing q()). 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Quit R by pressing button (tcltk) (PR#1475)
Peter Dalgaard BSA