diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-10-04 16:20:29 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-10-07 08:06:32 +0200 |
commit | 2b371a50cbc1f54284fcea3834834ca58fc28fd0 (patch) | |
tree | 156ec5ad28cbf98fac083a870e79daf0ebb49bf3 /src/qml/qml/qqmlprivate.h | |
parent | 138f09bd63b8070686ed8a282375dbcf3ce7674f (diff) |
qmlRegisterSingletonInstance: Do not crash if instance gets deleted
Use a QPointer, so that we notice if the object has been deleted.
Also ensure that in the documentation the function is in a single line,
as qdoc will otherwise silently omit it.
Change-Id: Idecd370d00089997cd18b3247ad2290a561b2b69
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlprivate.h')
-rw-r--r-- | src/qml/qml/qqmlprivate.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h index e6dd5e0b16..bfd3611fb8 100644 --- a/src/qml/qml/qqmlprivate.h +++ b/src/qml/qml/qqmlprivate.h @@ -58,6 +58,7 @@ #include <QtCore/qglobal.h> #include <QtCore/qvariant.h> #include <QtCore/qurl.h> +#include <QPointer> QT_BEGIN_NAMESPACE @@ -326,7 +327,7 @@ namespace QQmlPrivate { QObject *operator()(QQmlEngine *, QJSEngine *); - QObject *m_object; + QPointer<QObject> m_object; bool alreadyCalled = false; }; } |