diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-16 16:54:50 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-16 16:54:50 +0000 |
commit | 88014d3a00de0ea7c4db31cca2d8257b06da15d5 (patch) | |
tree | 55160f1e87398f72f93f5d378e2851aa03ef94de /ext/tk/sample | |
parent | 0a10a2580bb066d92ff6f7545bba2f02a0d47c49 (diff) | |
download | ruby-88014d3a00de0ea7c4db31cca2d8257b06da15d5.tar.gz ruby-88014d3a00de0ea7c4db31cca2d8257b06da15d5.tar.xz ruby-88014d3a00de0ea7c4db31cca2d8257b06da15d5.zip |
* ext/tk/tcltklib.c: SEGV when exit.
* ext/tk/lib/tk.rb: add a check for safety to Tk.exit.
* ext/tk/sample/irbtkw.rbw: freezes when receives SIGINT.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample')
-rw-r--r-- | ext/tk/sample/irbtkw.rbw | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/ext/tk/sample/irbtkw.rbw b/ext/tk/sample/irbtkw.rbw index 3fb6dde62..04de3a202 100644 --- a/ext/tk/sample/irbtkw.rbw +++ b/ext/tk/sample/irbtkw.rbw @@ -48,10 +48,20 @@ console.yscrollbar(TkScrollbar.new(top, :width=>10).pack(:before=>console, :side=>:right, :expand=>false, :fill=>:y)) + +# save original I/O +out = $stdout +err = $stderr + irb_thread = nil ev_loop = Thread.new{ - Tk.mainloop - irb_thread.kill if irb_thread + begin + Tk.mainloop + ensure + $stdout = out + $stderr = err + irb_thread.kill if irb_thread + end } # window position control @@ -142,5 +152,5 @@ console.bind('Control-c'){ irb_thread.join # exit -ev_thread.kill +ev_loop.kill Tk.exit |