diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-10-25 13:49:58 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-10-28 09:37:02 +0200 |
commit | 34a24c70280cc80d0cf1e268a05a52902af3b9aa (patch) | |
tree | 0e66f2dfe25c5465b883d72af48a67b7cb6d064b /src/qml/qml/qqmlobjectcreator.cpp | |
parent | 257319079562368b6ee731f54e3f69647c3417b7 (diff) |
Replace ActiveOcRestorer with QScopedValueRollback
No need to have a custom class for an issue that is solved generically
Change-Id: Ic4c5f3abd31037e6ab7dac2ced4ed9eeabfdccfa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 27385d1730..d68ad69260 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -65,18 +65,6 @@ QT_USE_NAMESPACE -namespace { -struct ActiveOCRestorer -{ - ActiveOCRestorer(QQmlObjectCreator *creator, QQmlEnginePrivate *ep) - : ep(ep), oldCreator(ep->activeObjectCreator) { ep->activeObjectCreator = creator; } - ~ActiveOCRestorer() { ep->activeObjectCreator = oldCreator; } - - QQmlEnginePrivate *ep; - QQmlObjectCreator *oldCreator; -}; -} - QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, QQmlContextData *creationContext, QQmlIncubatorPrivate *incubator) : phase(Startup) @@ -1163,7 +1151,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo QString typeName; Q_TRACE_EXIT(QQmlObjectCreator_createInstance_exit, typeName); - ActiveOCRestorer ocRestorer(this, QQmlEnginePrivate::get(engine)); + QScopedValueRollback<QQmlObjectCreator*> ocRestore(QQmlEnginePrivate::get(engine)->activeObjectCreator, this); bool isComponent = false; QObject *instance = nullptr; @@ -1364,7 +1352,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru phase = Finalizing; QQmlObjectCreatorRecursionWatcher watcher(this); - ActiveOCRestorer ocRestorer(this, QQmlEnginePrivate::get(engine)); + QScopedValueRollback<QQmlObjectCreator*> ocRestore(QQmlEnginePrivate::get(engine)->activeObjectCreator, this); while (!sharedState->allCreatedBindings.isEmpty()) { QQmlAbstractBinding::Ptr b = sharedState->allCreatedBindings.pop(); |