From cedd73279403244bbf4b74da4c3ec60111e60399 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 24 Aug 2015 09:07:10 +0200 Subject: Explicitly push/pop ExecutionContexts Avoid the implicit push inside the execution context constructor and rather make this explicit in the code. Change-Id: I1bb0fb523fddbb273fc666370d619f55f49cd40a Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlmetatype.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/qml/qml/qqmlmetatype.cpp') diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index fbb21f4562..f0debb8e59 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -217,12 +217,10 @@ public: void QQmlType::SingletonInstanceInfo::init(QQmlEngine *e) { QV4::ExecutionEngine *v4 = QV8Engine::getV4(e->handle()); + v4->pushGlobalContext(); if (scriptCallback && scriptApi(e).isUndefined()) { - v4->pushGlobalContext(); setScriptApi(e, scriptCallback(e, e)); - v4->popContext(); } else if (qobjectCallback && !qobjectApi(e)) { - v4->pushGlobalContext(); QObject *o = qobjectCallback(e, e); setQObjectApi(e, o); if (!o) { @@ -230,14 +228,12 @@ void QQmlType::SingletonInstanceInfo::init(QQmlEngine *e) } // if this object can use a property cache, create it now QQmlData::ensurePropertyCache(e, o); - v4->popContext(); } else if (!url.isEmpty() && !qobjectApi(e)) { - v4->pushGlobalContext(); QQmlComponent component(e, url, QQmlComponent::PreferSynchronous); QObject *o = component.create(); setQObjectApi(e, o); - v4->popContext(); } + v4->popContext(); } void QQmlType::SingletonInstanceInfo::destroy(QQmlEngine *e) -- cgit v1.2.3