diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-25 05:49:10 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-25 05:49:10 +0000 |
commit | 9a47a0460792a1c7447cff0dfe1059877da87be2 (patch) | |
tree | e1049c37508f683d974133eddfc03e09eb2558cb /ext/tk/lib/tkcanvas.rb | |
parent | f3d3cfb30dc3f8ea018ef23ae4295b10d8bdb963 (diff) |
tkcanvas.rb :
* Although requiring manual control of GC, memory eating problem
of TkCanvas Items is fixed. Probably, a time when GC should run
is only after removing many canvas items. GC's cost is large
and the man who knows proper timing to start GC is the man who
create the script. So, Ruby/Tk doesn't start GC automatically.
tktext.rb :
* add some methods and bug fix
tk.rb :
* add widget destroy hook binding to TkBindTag::ALL
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkcanvas.rb')
-rw-r--r-- | ext/tk/lib/tkcanvas.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb index 8c5b610f18..a98d770ccd 100644 --- a/ext/tk/lib/tkcanvas.rb +++ b/ext/tk/lib/tkcanvas.rb @@ -32,6 +32,10 @@ class TkCanvas<TkWindow WidgetClassName = 'Canvas'.freeze WidgetClassNames[WidgetClassName] = self + def __destroy_hook__ + TkcItem::CItemID_TBL.delete(@path) + end + def create_self(keys) if keys and keys != None tk_call 'canvas', @path, *hash_kv(keys) @@ -119,6 +123,11 @@ class TkCanvas<TkWindow end def delete(*args) + if TkcItem::CItemID_TBL[self.path] + find('withtag', *args).each{|item| + TkcItem::CItemID_TBL[self.path].delete(item.id) + } + end tk_send 'delete', *args.collect{|t| tagid(t)} self end |