diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ext/stringio/stringio.c | 11 |
2 files changed, 9 insertions, 10 deletions
@@ -1,3 +1,7 @@ +Thu Aug 11 23:29:03 2005 Nobuyoshi Nakada <[email protected]> + + * ext/stringio/stringio.c: keep holding string after closed. + Thu Aug 11 13:01:48 2005 Kouhei Sutou <[email protected]> * lib/rss: fixed sort bug. [ruby-list:41018] @@ -46,9 +50,9 @@ Wed Aug 10 10:38:50 2005 Yukihiro Matsumoto <[email protected]> Wed Aug 10 10:29:40 2005 Hidetoshi NAGAI <[email protected]> - * 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; } |