From: "H.Yamamoto" Date: 2005-02-09T20:05:41+09:00 Subject: [ruby-dev:25665] Re: some problems on ext/tk/sample/**/*.rb 山本です。 >[ruby-dev:25663] ならば下のパッチで表示されなくなります。 素の Rev1.2 でも、下の試験用パッチで同じ挙動(TCL_ERROR で表示され、 その他で表示されない)を示したので、今回なされたウィンドウ非表示 対策の分は必要ないかもしれません。 Index: tcltklib.c =================================================================== RCS file: /src/ruby/ext/tk/tcltklib.c,v retrieving revision 1.2 diff -u -w -b -p -r1.2 tcltklib.c --- tcltklib.c 31 Jan 2005 04:14:50 -0000 1.2 +++ tcltklib.c 9 Feb 2005 10:23:56 -0000 @@ -120,6 +120,16 @@ int *tclDummyMathPtr = (int *) matherr; # endif #endif +static VALUE foo = Qnil; + +static void hoge(void) { + if (!NIL_P(foo)) { + volatile VALUE res = foo; + foo = Qnil; + rb_raise(rb_eSystemExit, RSTRING(res)->ptr); + } +} + /*---- module TclTkLib ----*/ struct invoke_queue { @@ -733,6 +743,7 @@ lib_eventloop_core(check_root, update_fl } found_event = Tcl_DoOneEvent(event_flag); + hoge(); if (update_flag != 0) { if (found_event) { @@ -782,8 +793,10 @@ lib_eventloop_core(check_root, update_fl } if (Tcl_DoOneEvent(event_flag)) { + hoge(); tick_counter++; } else { + hoge(); if (update_flag != 0) { DUMP1("update complete"); return 0; @@ -1063,6 +1076,7 @@ lib_do_one_event_core(argc, argv, self, /* found_event = Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT); */ found_event = Tcl_DoOneEvent(flags); + hoge(); if (found_event) { return Qtrue; @@ -1438,14 +1452,6 @@ ip_ruby_eval(clientData, interp, argc, a thr_crit_bup = rb_thread_critical; rb_thread_critical = Qtrue; - /* Tcl_Eval(interp, "destroy ."); */ - if (Tk_GetNumMainWindows() > 0) { - Tk_Window main_win = Tk_MainWindow(interp); - if (main_win != (Tk_Window)NULL) { - Tk_DestroyWindow(main_win); - } - } - /* StringValue(res); */ res = rb_funcall(res, ID_message, 0, 0); @@ -1453,7 +1459,9 @@ ip_ruby_eval(clientData, interp, argc, a rb_thread_critical = thr_crit_bup; - rb_raise(rb_eSystemExit, RSTRING(res)->ptr); + foo = res; + + return TCL_OK; } else if (rb_obj_is_kind_of(res, eLocalJumpError)) { VALUE reason = rb_ivar_get(res, ID_at_reason); @@ -1835,14 +1843,6 @@ ip_ruby_cmd(clientData, interp, argc, ar thr_crit_bup = rb_thread_critical; rb_thread_critical = Qtrue; - /* Tcl_Eval(interp, "destroy ."); */ - if (Tk_GetNumMainWindows() > 0) { - Tk_Window main_win = Tk_MainWindow(interp); - if (main_win != (Tk_Window)NULL) { - Tk_DestroyWindow(main_win); - } - } - /* StringValue(res); */ res = rb_funcall(res, ID_message, 0, 0); @@ -1850,7 +1850,9 @@ ip_ruby_cmd(clientData, interp, argc, ar rb_thread_critical = thr_crit_bup; - rb_raise(rb_eSystemExit, RSTRING(res)->ptr); + foo = res; + + return TCL_OK; } else if (rb_obj_is_kind_of(res, eLocalJumpError)) { VALUE reason = rb_ivar_get(res, ID_at_reason);