Tracing: Only call QFutureWatcher::setFuture() after connecting to it

Fixes: QTCREATORBUG-21485
Change-Id: Icc44cf0195775d31934a60cb064addc94b152d92
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Ulf Hermann
2018-11-14 13:46:49 +01:00
parent efe30bc5a5
commit b8dcaa455e

View File

@@ -283,7 +283,6 @@ QFuture<void> TimelineTraceManager::load(const QString &filename)
});
QFutureWatcher<void> *watcher = new QFutureWatcher<void>(reader);
watcher->setFuture(future);
connect(watcher, &QFutureWatcherBase::canceled, this, &TimelineTraceManager::clearAll);
connect(watcher, &QFutureWatcherBase::finished, this, [this, reader]() {
if (!reader->isCanceled()) {
@@ -294,6 +293,7 @@ QFuture<void> TimelineTraceManager::load(const QString &filename)
finalize();
}
});
watcher->setFuture(future);
return future;
}