Hi Hidetoshi, I understand your need and as I asked for help, I have to help you back :) So I applied the patch to tk.rb : ============================== ... set __initial_state_of_rubytk__ 1 trace add variable __initial_state_of_rubytk__ unset __startup_rbtk_mainloop__ update EOS begin begin #TclTkLib.mainloop_abort_on_exception = false ... and ... } until INTERP_THREAD[:interp] #Thread.pass INTERP_THREAD.run end # INTERP_THREAD.run raise INTERP_THREAD[:interp] if INTERP_THREAD[:interp].kind_of? Exception ... ============================== Running the small script gives the same problem ; here is the end of the debug output showing an exception : ============================== tcltklib: destroy root widget tcltklib: check `finalize-hook-proc' tcltklib: check `foreach' & `after' tcltklib: cancel after callbacks tcltklib: finish ip_finalize Exception `TypeError' at /usr/lib/ruby/1.9.1/tk.rb:1283 - exception class/object expected tcltklib: eventloop_ensure: current-thread : 8802278 tcltklib: eventloop_ensure: eventloop-thread : 8802278 tcltklib: eventloop-ensure: new eventloop-thread -> 4 tcltklib: finish current eventloop 8802278 tcltklib: ip is deleted tcltklib: ip is deleted tcltklib: ip is deleted tcltklib: delete deleted IP tcltklib: free Tcl Interp 881a678 tcltklib: complete freeing Tcl Interp ============================== But the weird thing is that sometimes it runs OK ! (once every 6 ou 7 times) ; I just run the same command again and again... Hope this will help ! Best regards Stéphane