From c06b78ca928f410d97b38a498b197471cd73f27b Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 11 Aug 2005 14:29:46 +0000 Subject: * ext/stringio/stringio.c: keep holding string after closed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++-- ext/stringio/stringio.c | 11 +++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc10312bd9..c7e270be8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Aug 11 23:29:03 2005 Nobuyoshi Nakada + + * ext/stringio/stringio.c: keep holding string after closed. + Thu Aug 11 13:01:48 2005 Kouhei Sutou * lib/rss: fixed sort bug. [ruby-list:41018] @@ -46,9 +50,9 @@ Wed Aug 10 10:38:50 2005 Yukihiro Matsumoto Wed Aug 10 10:29:40 2005 Hidetoshi NAGAI - * ext/tk/lib/tk.rb: fix bug on handling __ruby2val_optkeys(). + * ext/tk/lib/tk.rb: fix bug on handling __ruby2val_optkeys(). - * ext/tk/lib/tk/itemconfig.rb: fix bug on handling + * ext/tk/lib/tk/itemconfig.rb: fix bug on handling __item_ruby2val_optkeys(). * ext/tk/lib/tk/canvas.rb: didn't check __item_ruby2val_optkeys(). diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index db93c1ff89..55678f71d8 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -382,10 +382,9 @@ strio_close(self) VALUE self; { struct StringIO *ptr = StringIO(self); - if (CLOSED(ptr)) { + if (CLOSED(ptr) || !(ptr->flags & FMODE_READWRITE)) { rb_raise(rb_eIOError, "closed stream"); } - ptr->string = Qnil; ptr->flags &= ~FMODE_READWRITE; return Qnil; } @@ -405,9 +404,7 @@ strio_close_read(self) if (!READABLE(ptr)) { rb_raise(rb_eIOError, "closing non-duplex IO for reading"); } - if (!((ptr->flags &= ~FMODE_READABLE) & FMODE_READWRITE)) { - ptr->string = Qnil; - } + ptr->flags &= ~FMODE_READABLE; return Qnil; } @@ -426,9 +423,7 @@ strio_close_write(self) if (!WRITABLE(ptr)) { rb_raise(rb_eIOError, "closing non-duplex IO for writing"); } - if (!((ptr->flags &= ~FMODE_WRITABLE) & FMODE_READWRITE)) { - ptr->string = Qnil; - } + ptr->flags &= ~FMODE_WRITABLE; return Qnil; } -- cgit v1.2.3