From ffe45f1896adfff93258b917f6a566dcc06a6597 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 25 Mar 2013 15:55:40 +0100 Subject: QNonContiguousByteDevice: roll back complete internal state in reset() ... otherwise we would not start reading from the beginning when the device was reset. Change-Id: Ida196eb40790fba56ff2eed782fd93a3015222f9 Reviewed-by: Shane Kearns --- src/corelib/io/qnoncontiguousbytedevice.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp index c0fbbaf103..253aa2aafb 100644 --- a/src/corelib/io/qnoncontiguousbytedevice.cpp +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -391,6 +391,13 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset() bool reset = (initialPosition == 0) ? device->reset() : device->seek(initialPosition); if (reset) { eof = false; // assume eof is false, it will be true after a read has been attempted + totalAdvancements = 0; //reset the progress counter + if (currentReadBuffer) { + delete currentReadBuffer; + currentReadBuffer = 0; + } + currentReadBufferAmount = 0; + currentReadBufferPosition = 0; return true; } -- cgit v1.2.3