diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2017-04-19 14:18:06 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-04-19 18:01:17 +0000 |
commit | f76dd50d42b91234dcb7c0ea0775382e369f11ae (patch) | |
tree | 7c5a5913d61c22f24e24d22fc20d984f03ed20ca | |
parent | aebb0f69502a38262ae57cc905efbe5fdc315f9a (diff) |
Fix for dangling object pointers in QQmlErrors
This rarely happens - only seen with Delegates - when
- an object is created during incubation
- some error occurs in this object
- the object gets deleted before the incubation run finishes
Because the errors are delivered after the incubation run finished, the
object() pointer of QQmlError is now a dangling pointer that will crash
your application if accessed.
Change-Id: Idd9fccbc58e4ada67bde3ca1aeec736aa9374789
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 6a8a7e60ab91f958a1dd63e787a23f6e09f463b1)
-rw-r--r-- | src/qml/qml/qqmlerror.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp index adab3cd6c4..0c3c9c8005 100644 --- a/src/qml/qml/qqmlerror.cpp +++ b/src/qml/qml/qqmlerror.cpp @@ -37,6 +37,7 @@ #include <QtCore/qdebug.h> #include <QtCore/qfile.h> #include <QtCore/qstringlist.h> +#include <QtCore/qpointer.h> #include <private/qv4errorobject_p.h> @@ -78,7 +79,7 @@ public: QString description; quint16 line; quint16 column; - QObject *object; + QPointer<QObject> object; }; QQmlErrorPrivate::QQmlErrorPrivate() |