diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-01-16 17:58:23 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-01-17 14:27:29 +0000 |
commit | 5555b7137b8ac683081dbd4a7da268ce220e279c (patch) | |
tree | 735e3ae09557c5c222ba7ae8fb45ca8b524b6773 /src/plugins/qmlprofiler/qmlprofilertool.cpp | |
parent | 9a57f195523d11dda4c04de733675abeeb6063d8 (diff) |
QmlProfiler: Defer chained state changes
If the state is changed again from a signal handler before all handlers
for the signal have been processed, we can get confusing results. Defer
those calls.
Change-Id: I73f7b8faa48ee00c17fdedb4140823d7a1b13435
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilertool.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertool.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 9cfc21d6a76..a688299530d 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -743,8 +743,11 @@ void QmlProfilerTool::clientsDisconnected() } // ... and return to the "base" state - if (d->m_profilerState->currentState() == QmlProfilerStateManager::AppDying) - d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle); + if (d->m_profilerState->currentState() == QmlProfilerStateManager::AppDying) { + QTimer::singleShot(0, d->m_profilerState, [this]() { + d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle); + }); + } } void addFeatureToMenu(QMenu *menu, ProfileFeature feature, quint64 enabledFeatures) @@ -879,7 +882,9 @@ void QmlProfilerTool::profilerStateChanged() d->m_profilerConnections->stopRecording(); } else { // Directly transition to idle - d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle); + QTimer::singleShot(0, d->m_profilerState, [this]() { + d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle); + }); } break; default: |