From 5ebf7049532575d8e57677a4e5bf61753c0c35e4 Mon Sep 17 00:00:00 2001 From: nagai Date: Mon, 16 Jun 2008 16:54:50 +0000 Subject: * 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 --- ext/tk/sample/irbtkw.rbw | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'ext/tk/sample/irbtkw.rbw') 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 -- cgit v1.2.3