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

@ -113,6 +113,13 @@ Thu Apr 17 22:03:52 2008 akira yamada <akira@arika.org>
test/uri/test_ftp.rb, test/uri/test_generic.rb: backported from 1.9. test/uri/test_ftp.rb, test/uri/test_generic.rb: backported from 1.9.
[ruby-dev:31318] [ruby-dev:31318]
Wed Apr 16 14:22:42 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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.
Wed Apr 16 06:03:45 2008 Akinori MUSHA <knu@iDaemons.org> Wed Apr 16 06:03:45 2008 Akinori MUSHA <knu@iDaemons.org>
* test/ruby/test_settracefunc.rb (TestSetTraceFunc#test_event): * test/ruby/test_settracefunc.rb (TestSetTraceFunc#test_event):

View file

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