diff options
Diffstat (limited to 'common/stream.cpp')
-rw-r--r-- | common/stream.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/common/stream.cpp b/common/stream.cpp index 60b40d0df2..30b3bca497 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -20,6 +20,7 @@ * */ +#include "common/ptr.h" #include "common/stream.h" #include "common/memstream.h" #include "common/substream.h" @@ -258,8 +259,7 @@ namespace { */ class BufferedReadStream : virtual public ReadStream { protected: - ReadStream *_parentStream; - DisposeAfterUse::Flag _disposeParentStream; + DisposablePtr<ReadStream> _parentStream; byte *_buf; uint32 _pos; bool _eos; // end of stream @@ -278,8 +278,7 @@ public: }; BufferedReadStream::BufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream) - : _parentStream(parentStream), - _disposeParentStream(disposeParentStream), + : _parentStream(parentStream, disposeParentStream), _pos(0), _eos(false), _bufSize(0), @@ -291,8 +290,6 @@ BufferedReadStream::BufferedReadStream(ReadStream *parentStream, uint32 bufSize, } BufferedReadStream::~BufferedReadStream() { - if (_disposeParentStream) - delete _parentStream; delete[] _buf; } |