aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcomponent.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-07-12 01:01:11 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2019-07-12 15:56:39 +0200
commitd389fe039203f318a8c9a836dea4c348a1a892a8 (patch)
tree223f8c3c6869818c43a139040bcd3862f0393095 /src/qml/qml/qqmlcomponent.cpp
parentde0d91abbbcf58a66018a08ca77bb4d63a5efda1 (diff)
parent47ad6c57d1873c3da362cfad7cc81dc0aa2720a4 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: src/qml/qml/qqmltypeloader.cpp src/quick/scenegraph/qsgopengldistancefieldglyphcache.cpp Change-Id: I1a226d8738db2ec06e3cef240a0e040e7c144cad
Diffstat (limited to 'src/qml/qml/qqmlcomponent.cpp')
-rw-r--r--src/qml/qml/qqmlcomponent.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 59b5cc2691..fefe2bc685 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -569,6 +569,12 @@ void QQmlComponent::setData(const QByteArray &data, const QUrl &url)
{
Q_D(QQmlComponent);
+ if (!d->engine) {
+ // ###Qt6: In Qt 6, it should be impossible for users to create a QQmlComponent without an engine, and we can remove this check
+ qWarning("QQmlComponent: Must provide an engine before calling setData");
+ return;
+ }
+
d->clear();
d->url = url;
@@ -774,6 +780,12 @@ QObject *QQmlComponent::create(QQmlContext *context)
{
Q_D(QQmlComponent);
+ if (!d->engine) {
+ // ###Qt6: In Qt 6, it should be impossible for users to create a QQmlComponent without an engine, and we can remove this check
+ qWarning("QQmlComponent: Must provide an engine before calling create");
+ return nullptr;
+ }
+
if (!context)
context = d->engine->rootContext();