From 719c1faef886cd346e27a0996134d3620e82da39 Mon Sep 17 00:00:00 2001 From: Hiroshi Shirosaki Date: Thu, 7 Aug 2014 16:14:45 +0900 Subject: [PATCH] Fix tk crash with Tk 8.6.1 on Ubuntu * ext/tk/extconf.rb (TkLib_Config): remove 8.6 from unsupported. * ext/tk/extconf.rb (get_tclConfig_dirs): add a directory for config files on Ubuntu x86_64. * ext/tk/tcltklib.c (ip_wrap_namespace_command): fix crash of `__orig_namespace_command__` command. Reading `objClientData` of the command causes access violation. Instead we use `rename` command to create `__orig_namespace_command__`. [ruby-core:53097] [Bug #8000] --- ext/tk/extconf.rb | 6 +++++- ext/tk/tcltklib.c | 10 +--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb index 99a7367..38d74ea 100644 --- a/ext/tk/extconf.rb +++ b/ext/tk/extconf.rb @@ -12,7 +12,7 @@ TkLib_Config['search_versions'] = %w[8.5 8.4] # At present, Tcl/Tk8.6 is not supported. TkLib_Config['unsupported_versions'] = - %w[8.8 8.7 8.6] # At present, Tcl/Tk8.6 is not supported. + %w[8.8 8.7] # At present, Tcl/Tk8.7 is not supported. TkLib_Config['major_nums'] = '87' @@ -477,6 +477,10 @@ def get_tclConfig_dirs config_dir << RbConfig::CONFIG['libdir'] + ['/usr/lib/x86_64-linux-gnu'].each do |dir| + config_dir << dir if File.exist?(dir) + end + ((maybe_64bit?)? ['lib64', 'lib']: ['lib']).each{|dir| config_dir.concat [ File.join(RbConfig::CONFIG['exec_prefix'], dir), diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index c67b020..59b9065 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -6074,15 +6074,7 @@ ip_wrap_namespace_command(interp) return; } - if (orig_info.isNativeObjectProc) { - Tcl_CreateObjCommand(interp, "__orig_namespace_command__", - orig_info.objProc, orig_info.objClientData, - orig_info.deleteProc); - } else { - Tcl_CreateCommand(interp, "__orig_namespace_command__", - orig_info.proc, orig_info.clientData, - orig_info.deleteProc); - } + Tcl_Eval(interp, "rename namespace __orig_namespace_command__"); Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *)NULL); -- 1.9.1