diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-06-23 13:09:03 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-08-02 16:32:37 +0000 |
commit | a6633e41e7c6795bbbc016ce36e4ff91ec5248ad (patch) | |
tree | 084c03ead7bc38c146333e262637f3fd0a45881d /src/qml/qml/qqmlmetatype.cpp | |
parent | ee1de29c2dcb16a4b0c691c7fc53310e175fa49f (diff) |
Use QQmlType by value in the type wrapper
Task-number: QTBUG-61536
Change-Id: Ie40cb3a6e170331b0ec7ab5deaf7c1d7ef0cdaeb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 1959146388..2ff2cdc189 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -463,6 +463,13 @@ QQmlType &QQmlType::operator =(const QQmlType &other) return *this; } +QQmlType::QQmlType(QQmlTypePrivate *priv) + : d(priv) +{ + if (d) + d->refCount.ref(); +} + QQmlType::~QQmlType() { if (d && !d->refCount.deref()) @@ -1073,6 +1080,18 @@ int QQmlType::enumValue(QQmlEnginePrivate *engine, const QV4::String *name, bool return -1; } +void QQmlType::refHandle(QQmlTypePrivate *priv) +{ + if (priv) + priv->refCount.ref(); +} + +void QQmlType::derefHandle(QQmlTypePrivate *priv) +{ + if (priv && !priv->refCount.deref()) + delete priv; +} + QQmlTypeModule::QQmlTypeModule() : d(new QQmlTypeModulePrivate) { |