aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-08 01:00:31 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-08 12:49:05 +0200
commitaea512f8ced4a1a219d5e15724967bbc3338cbc5 (patch)
tree7b547e09b83ae62854de26f181bb0af65bc1bd14 /src/qml/qml/qqml.cpp
parent914e0300792856ddac9b99b20a8d88dd6f087fa6 (diff)
parent38e97c68ba25c29a6fbdd3f79d56fd52a0f58a4c (diff)
Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r--src/qml/qml/qqml.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index 0f81d83f13..a33936647f 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -79,6 +79,13 @@ int qmlTypeId(const char *uri, int versionMajor, int versionMinor, const char *q
// From qqmlprivate.h
QObject *QQmlPrivate::RegisterSingletonFunctor::operator()(QQmlEngine *qeng, QJSEngine *)
{
+ if (!m_object) {
+ QQmlError error;
+ error.setDescription(QLatin1String("The registered singleton has already been deleted. Ensure that it outlives the engine."));
+ QQmlEnginePrivate::get(qeng)->warning(qeng, error);
+ return nullptr;
+ }
+
if (qeng->thread() != m_object->thread()) {
QQmlError error;
error.setDescription(QLatin1String("Registered object must live in the same thread as the engine it was registered with"));