QmlProfiler: Don't create widgets in a worker thread

We better call QmlProfilerModelManager::complete() from the main
thread. There are too many things that can break if it's called from a
worker thread.

Change-Id: I92211df7ec072d572ed82dc1203efd2f67b4b540
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-09-10 12:06:10 +02:00
parent fba007741c
commit 60ead88856

View File

@@ -351,6 +351,7 @@ void QmlProfilerModelManager::complete()
// Load notes after the timeline models have been initialized.
d->notesModel->loadData();
setState(QmlProfilerDataState::Done);
emit loadFinished();
break;
case QmlProfilerDataState::AcquiringData:
// Make sure the trace fits into the time span.
@@ -431,9 +432,9 @@ void QmlProfilerModelManager::load()
file->close();
file->deleteLater();
// The completion step uses the old progress display widget for now.
complete();
QMetaObject::invokeMethod(this, "loadFinished", Qt::QueuedConnection);
// The completion step uses the old progress display widget for now. We need to do this in
// the main thread as it creates widgets.
QMetaObject::invokeMethod(this, "complete", Qt::QueuedConnection);
});
Core::ProgressManager::addTask(result, tr("Loading Trace Data"), Constants::TASK_LOAD);