summaryrefslogtreecommitdiff
path: root/ext/tk/sample
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-16 16:54:50 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-16 16:54:50 +0000
commit5ebf7049532575d8e57677a4e5bf61753c0c35e4 (patch)
tree55160f1e87398f72f93f5d378e2851aa03ef94de /ext/tk/sample
parent1723931102da715e5d9c8e5fbc8ab3756eaa1151 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@17368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample')
-rw-r--r--ext/tk/sample/irbtkw.rbw16
1 files changed, 13 insertions, 3 deletions
diff --git a/ext/tk/sample/irbtkw.rbw b/ext/tk/sample/irbtkw.rbw
index 3fb6dde626..04de3a2022 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