aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi/qjsengine.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-13 00:28:14 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-13 08:28:27 +0200
commitae745746a666134d9e9258b8c2ff00540624d835 (patch)
tree8294fffa3d752d61f79004fb04e21e927472fd8f /src/qml/jsapi/qjsengine.cpp
parenta7b383ab989e74ef552c2ef9c38377e065f1ab0e (diff)
parent531d00c1909527cb1bc28f17197267ccde408b0c (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/qml/jsapi/qjsengine.cpp src/qml/qml/qqmlengine_p.h src/quick/items/qquickanchors.cpp src/quick/items/qquickanimatedimage_p_p.h src/quick/items/qquickitem_p.h tests/auto/qml/qqmlecmascript/testtypes.h tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp tests/benchmarks/qml/creation/tst_creation.cpp Change-Id: I65861e32f16e8a04c7090a90231627e1ebf6ba6f
Diffstat (limited to 'src/qml/jsapi/qjsengine.cpp')
-rw-r--r--src/qml/jsapi/qjsengine.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index 424d5548a1..257dd357fd 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -247,6 +247,11 @@ Q_DECLARE_METATYPE(QList<int>)
QT_BEGIN_NAMESPACE
+static void checkForApplicationInstance()
+{
+ if (!QCoreApplication::instance())
+ qFatal("QJSEngine: Must construct a QCoreApplication before a QJSEngine");
+}
/*!
Constructs a QJSEngine object.
@@ -270,6 +275,8 @@ QJSEngine::QJSEngine(QObject *parent)
: QObject(*new QJSEnginePrivate, parent)
, d(new QV8Engine(this))
{
+ checkForApplicationInstance();
+
QJSEnginePrivate::addToDebugServer(this);
}
@@ -280,6 +287,7 @@ QJSEngine::QJSEngine(QJSEnginePrivate &dd, QObject *parent)
: QObject(dd, parent)
, d(new QV8Engine(this))
{
+ checkForApplicationInstance();
}
/*!