Tracing: Fix past-end handling in TraceStashFile::Iterator

If we read past the end of the stream in open() or next() we don't want
to process the resulting event. This fixes the QmlProfilerTraceClient
test.

Change-Id: Iaaa60f462aa588096001579efae7ed1a88d6d6a3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Ulf Hermann
2018-05-22 14:39:11 +02:00
parent c0b8ac7966
commit dd9c7de89a

View File

@@ -75,10 +75,13 @@ public:
{
if (readFile->open(QIODevice::ReadOnly)) {
readStream->setDevice(readFile.get());
if (readStream->atEnd())
if (readStream->atEnd()) {
streamAtEnd = true;
else
} else {
(*readStream) >> nextEvent;
if (readPastEnd())
streamAtEnd = true;
}
return true;
}
streamAtEnd = true;
@@ -107,6 +110,8 @@ public:
const Event result = std::move(nextEvent);
(*readStream) >> nextEvent;
if (readPastEnd())
streamAtEnd = true;
return result;
}