1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/tempfile.rb (Tempfile::_close): check @data before modifying

it backported from 1.9.  [ruby-dev:34094]

* lib/tempfile.rb (Tempfile::close): clear @data and @tmpname.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-04-21 06:54:48 +00:00
parent e412278fdc
commit 192616f926
2 changed files with 10 additions and 1 deletions

View file

@ -95,7 +95,8 @@ class Tempfile < DelegateClass(File)
def _close # :nodoc:
@tmpfile.close if @tmpfile
@data[1] = @tmpfile = nil
@tmpfile = nil
@data[1] = nil if @data
end
protected :_close
@ -117,6 +118,7 @@ class Tempfile < DelegateClass(File)
_close
@clean_proc.call
ObjectSpace.undefine_finalizer(self)
@data = @tmpname = nil
end
# Unlinks the file. On UNIX-like systems, it is often a good idea