From c3183591b87a008aa412ad97b93ace43f40b494c Mon Sep 17 00:00:00 2001 From: nagai Date: Mon, 11 Apr 2005 17:29:15 +0000 Subject: * ext/tcltklib/tcltklib.c (ip_finalize): add existence check of Tcl commands before calling Tcl_GlobalEval(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/tcltklib/tcltklib.c | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index eeb0a62db..4b705b06b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Apr 12 02:21:55 2005 Hidetoshi NAGAI + + * ext/tcltklib/tcltklib.c (ip_finalize): add existence check of + Tcl commands before calling Tcl_GlobalEval(). + Mon Apr 11 23:47:21 2005 Masatoshi SEKI * lib/drb/drb.r: [druby-ja:123] fix: When reference of my object is diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index 21c9d904c..407894c2d 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -4407,7 +4407,11 @@ ip_finalize(ip) delete_slaves(ip); /* delete root widget */ - Tcl_GlobalEval(ip, "catch {destroy .}"); + if ( Tcl_GetCommandInfo(ip, "catch", &info) + && Tcl_GetCommandInfo(ip, "destroy", &info) ) { + DUMP1("call `destroy'"); + Tcl_GlobalEval(ip, "catch {destroy .}"); + } /* call finalize-hook-proc */ if (Tcl_GetCommandInfo(ip, finalize_hook_name, &info)) { @@ -4416,7 +4420,14 @@ ip_finalize(ip) } DUMP1("cancel after scripts"); - Tcl_GlobalEval(ip, "catch {foreach id [after info] {after cancel $id}}"); + DUMP1("check `foreach' & `after'"); + if ( Tcl_GetCommandInfo(ip, "catch", &info) + && Tcl_GetCommandInfo(ip, "foreach", &info) + && Tcl_GetCommandInfo(ip, "after", &info) ) { + DUMP1("call `foreach' & `after'"); + Tcl_GlobalEval(ip, + "catch {foreach id [after info] {after cancel $id}}"); + } Tcl_Release(ip); -- cgit