summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/timer.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-11 17:45:53 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-11 17:45:53 +0000
commita821833bb313dccdf8c3ad513af2c943be494a50 (patch)
tree56deadd8c71a5ecfcad15d9548e8a0d47a81d369 /ext/tk/lib/tk/timer.rb
parent32cabb82a4e2dd631250075142fc7c9e58230ae6 (diff)
* ext/tcltklib/tcltklib.c: add TclTkIp#allow_ruby_exit? and allow_ruby_exit=
* ext/tk/lib/multi-tk.rb: ditto. * ext/tk/lib/remote-tk.rb: ditto. * ext/tcltklib/MANUAL.euc: ditto. * ext/tcltklib/MANUAL.eng: ditto. * ext/tcltklib/tcltklib.c: fix some reasons of SEGV * ext/tk/tkutil.c: ditto. * ext/tk/lib/multi-tk.rb: ditto. * ext/tk/lib/tk/timer.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk/timer.rb')
-rw-r--r--ext/tk/lib/tk/timer.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index fa0a582..79d7ef5 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -28,7 +28,6 @@ class TkTimer
# class methods
###############################
def self.callback(obj_id)
- @after_id = nil
ex_obj = Tk_CBTBL[obj_id]
return "" if ex_obj == nil; # canceled
ex_obj.cb_call
@@ -59,6 +58,7 @@ class TkTimer
###############################
def do_callback
@in_callback = true
+ @after_id = nil
begin
@return_value = @current_proc.call(self)
rescue SystemExit
@@ -86,6 +86,10 @@ class TkTimer
end
def set_callback(sleep, args=nil)
+ if TkCore::INTERP.deleted?
+ self.cancel
+ return self
+ end
@after_script = "rb_after #{@id}"
@after_id = tk_call_without_enc('after', sleep, @after_script)
@current_args = args
@@ -313,6 +317,7 @@ class TkTimer
Tk_CBTBL[@id] = self
@do_loop = @loop_exec
@current_pos = 0
+ @after_id = nil
@init_sleep = 0
@init_proc = nil