summaryrefslogtreecommitdiffstats
path: root/ext/tk/tcltklib.c
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-11 17:29:51 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-11 17:29:51 +0000
commit24b5301d2a3adf64b8ee521f58fa8a70f79a7533 (patch)
tree6f1aa81e0b23d18731e5f938d2853b665ff51029 /ext/tk/tcltklib.c
parentb0c886f01a1c10dc912040018b4fbe52193e90f6 (diff)
downloadruby-24b5301d2a3adf64b8ee521f58fa8a70f79a7533.tar.gz
ruby-24b5301d2a3adf64b8ee521f58fa8a70f79a7533.tar.xz
ruby-24b5301d2a3adf64b8ee521f58fa8a70f79a7533.zip
* ext/tk/tcltklib.c (ip_finalize): add existence check of Tcl commands
before calling Tcl_GlobalEval(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/tcltklib.c')
-rw-r--r--ext/tk/tcltklib.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index 21c9d904c..f744df940 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -4407,16 +4407,29 @@ ip_finalize(ip)
delete_slaves(ip);
/* delete root widget */
- Tcl_GlobalEval(ip, "catch {destroy .}");
+ DUMP1("check `destroy'");
+ if ( Tcl_GetCommandInfo(ip, "catch", &info)
+ && Tcl_GetCommandInfo(ip, "destroy", &info) ) {
+ DUMP1("call `destroy'");
+ Tcl_GlobalEval(ip, "catch {destroy .}");
+ }
/* call finalize-hook-proc */
+ DUMP1("check `finalize-hook-proc'");
if (Tcl_GetCommandInfo(ip, finalize_hook_name, &info)) {
DUMP2("call finalize hook proc '%s'", finalize_hook_name);
Tcl_GlobalEval(ip, finalize_hook_name);
}
- DUMP1("cancel after scripts");
- Tcl_GlobalEval(ip, "catch {foreach id [after info] {after cancel $id}}");
+ DUMP1("cancel after callbacks");
+ 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);