From: Hidetoshi NAGAI Date: 2010-06-02T23:20:11+09:00 Subject: [ruby-core:30557] Re: tk doesn't startup well in doze From: Roger Pack Subject: [ruby-core:30550] Re: tk doesn't startup well in doze Date: Wed, 2 Jun 2010 02:00:37 +0900 Message-ID: > With 1.9.3 I now get this (exits fine, with mystery window, but > running an app yields:) > > irb(main):009:0> Tk.mainloop > RuntimeError: can't unset "__initail_state_of_rubytk__": no such variable Please give me one more help. Does the following patch work? Or does it need "RUN_EVENTLOOP_ON_MAIN_THREAD=true" to work fine? If the patch doesn't and "RUN_EVENTLOOP_ON_MAIN_THREAD=true" works, I set RUN_EVENTLOOP_ON_MAIN_THREAD to true as default on windows. Index: ext/tk/lib/tk.rb =================================================================== --- ext/tk/lib/tk.rb (revision 28127) +++ ext/tk/lib/tk.rb (working copy) @@ -1229,7 +1229,8 @@ INTERP_ROOT_CHECK = ConditionVariable.new INTERP_THREAD = Thread.new{ begin - Thread.current[:interp] = interp = TclTkIp.new(name, opts) + #Thread.current[:interp] = interp = TclTkIp.new(name, opts) + interp = TclTkIp.new(name, opts) rescue => e Thread.current[:interp] = e raise e @@ -1245,16 +1246,17 @@ Thread.current[:status] = status #sleep - # like as 1.8, withdraw a root widget before calling Tk.mainloop interp._eval <e Thread.current[:status].value = e @@ -1836,7 +1839,7 @@ end # like as 1.8, withdraw a root widget before calling Tk.mainloop - TkCore::INTERP._eval_without_enc('unset __initail_state_of_rubytk__') + TkCore::INTERP._eval_without_enc('catch {unset __initial_state_of_rubytk__}') begin TclTkLib.set_eventloop_window_mode(true) -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)