forked from qt-creator/qt-creator
QmlProfiler: Avoid overflowing the progress range when loading
The ProgressManager can only deal with at most (1 << 31) / 100. Change-Id: I03c61839fa5b9dab56b99f98a63ed7ab8b340c09 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -139,7 +139,7 @@ void QmlProfilerFileReader::setFuture(QFutureInterface<void> *future)
|
||||
bool QmlProfilerFileReader::load(QIODevice *device)
|
||||
{
|
||||
if (m_future) {
|
||||
m_future->setProgressRange(0, qMin(device->size(), qint64(INT_MAX)));
|
||||
m_future->setProgressRange(0, 1000);
|
||||
m_future->setProgressValue(0);
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ void QmlProfilerFileReader::progress(QIODevice *device)
|
||||
if (!m_future)
|
||||
return;
|
||||
|
||||
m_future->setProgressValue(qMin(device->pos(), qint64(INT_MAX)));
|
||||
m_future->setProgressValue(device->pos() * 1000 / device->size());
|
||||
}
|
||||
|
||||
bool QmlProfilerFileReader::isCanceled() const
|
||||
|
||||
Reference in New Issue
Block a user