forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user