From 24758ea6c24128d3da279ef52372fcd6884352ff Mon Sep 17 00:00:00 2001 From: nagai Date: Wed, 5 Apr 2006 16:08:45 +0000 Subject: * ext/tk/tcltklib.c: fix SEGV when embedding to an application. [ruby-core:7600] * ext/tk/tcltklib.c: fix SEGV at exit. [ruby-talk:186489] * ext/tk/tkutil/tkutil.c: follow to changing specification of instance_eval on ruby-1.9.x. * ext/tk/lib/tk.rb: ditto. * ext/tk/lib/multi-tk.rb: ditto. * ext/tk/lib/tk.rb: remove warning about redefinition of methods. * ext/tk/lib/tk/variable.rb: remove warning about unseting Tcl variables. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/lib/multi-tk.rb | 2 +- ext/tk/lib/tk.rb | 20 ++++++++++++-------- ext/tk/lib/tk/variable.rb | 12 +++++------- 3 files changed, 18 insertions(+), 16 deletions(-) (limited to 'ext/tk/lib') diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb index 6581ff8da..84c2322d5 100644 --- a/ext/tk/lib/multi-tk.rb +++ b/ext/tk/lib/multi-tk.rb @@ -142,7 +142,7 @@ class MultiTkIp ###################################### - @@CB_ENTRY_CLASS = Class.new(TkCallbackEntry){|c| + @@CB_ENTRY_CLASS = Class.new(TkCallbackEntry){ def initialize(ip, cmd) @ip = ip @cmd = cmd diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 55408dda2..bf053058d 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -1121,8 +1121,8 @@ module TkCore @init_ip_env = [].taint # table of Procs @add_tk_procs = [].taint # table of [name, args, body] - @cb_entry_class = Class.new(TkCallbackEntry){|c| - class << c + @cb_entry_class = Class.new(TkCallbackEntry){ + class << self def inspect sprintf("#", self.__id__) end @@ -2310,11 +2310,15 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end module TclTkLib - def self.encoding=(name) - TkCore::INTERP.encoding = name - end - def self.encoding - TkCore::INTERP.encoding + class << self + alias _encoding encoding + alias _encoding= encoding= + def encoding=(name) + TkCore::INTERP.encoding = name + end + def encoding + TkCore::INTERP.encoding + end end end @@ -4555,7 +4559,7 @@ end #Tk.freeze module Tk - RELEASE_DATE = '2005-12-07'.freeze + RELEASE_DATE = '2006-04-06'.freeze autoload :AUTO_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable' diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb index 1ea41b729..e5cacadc1 100644 --- a/ext/tk/lib/tk/variable.rb +++ b/ext/tk/lib/tk/variable.rb @@ -266,8 +266,11 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL') def initialize(val="", type=nil) # @id = Tk_VARIABLE_ID.join('') - @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_) - Tk_VARIABLE_ID[1].succ! + begin + @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_) + Tk_VARIABLE_ID[1].succ! + end until INTERP._invoke_without_enc('info', 'globals', @id).empty? + TkVar_ID_TBL[@id] = self @var = @id @@ -286,11 +289,6 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL') self.default_value_type = type - begin - INTERP._unset_global_var(@id) - rescue - end - # teach Tk-ip that @id is global var INTERP._invoke_without_enc('global', @id) #INTERP._invoke('global', @id) -- cgit