summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index f87c5fd394..c984cd3393 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -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