summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--lib/tempfile.rb11
-rw-r--r--version.h2
3 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index beab8644c8..327aeb690e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Feb 7 14:03:45 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * lib/tempfile.rb (Tempfile#_close): clear @tempfile and @data[1] even
+ when exception is raised at @tempfile.close. [ruby-dev:45113]
+
+ * lib/tempfile.rb (Tempfile#unlink): fix a typo.
+
Tue Feb 7 14:02:32 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* test/ruby/test_io.rb (test_autoclose_true_closed_by_finalizer,
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 22401b030c..8a517d6746 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -162,9 +162,12 @@ class Tempfile < DelegateClass(File)
end
def _close # :nodoc:
- @tmpfile.close if @tmpfile
- @tmpfile = nil
- @data[1] = nil if @data
+ begin
+ @tmpfile.close if @tmpfile
+ ensure
+ @tmpfile = nil
+ @data[1] = nil if @data
+ end
end
protected :_close
@@ -231,7 +234,7 @@ class Tempfile < DelegateClass(File)
File.unlink(@tmpname)
end
# remove tmpname from remover
- @data[0] = @data[2] = nil
+ @data[0] = @data[1] = nil
@tmpname = nil
rescue Errno::EACCES
# may not be able to unlink on Windows; just ignore
diff --git a/version.h b/version.h
index 9a3a8f9d49..07221eaf68 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 48
+#define RUBY_PATCHLEVEL 49
#define RUBY_RELEASE_DATE "2012-02-07"
#define RUBY_RELEASE_YEAR 2012