diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-11-10 09:42:13 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-11-12 12:24:29 +0100 |
commit | bdbc91cb90e9858cddc23da90ddd659262faa068 (patch) | |
tree | b166c2b9df84bf99393baa5bfacf14d25c469cb0 /src/qml/types | |
parent | 21237e40565c1331aab531ae2c262fdc2c96fc53 (diff) |
Fix life cycle methods of various types related to QQmlBind
Code checker complains about the absence of move ctors and operators.
While we're at it, make ctors default where possible, do not use const
rvalue refs, add noexcept where possible, properly disable moving and
copying of QQmlBindEntryContent, and inline the null check of
QV4::PersistentValueStorage::free().
Change-Id: I11b6511f39f3d84479dbacee7f3e3552a5fb2b5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmlbind.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp index a714c0285b..c474128553 100644 --- a/src/qml/types/qqmlbind.cpp +++ b/src/qml/types/qqmlbind.cpp @@ -81,6 +81,7 @@ enum class QQmlBindEntryKind: quint8 { * and the new kind is returned. */ union QQmlBindEntryContent { + Q_DISABLE_COPY_MOVE(QQmlBindEntryContent) public: QQmlBindEntryContent() {} ~QQmlBindEntryContent() {} @@ -175,9 +176,6 @@ private: Q_ASSERT(dead == QQmlBindEntryKind::None); Q_UNUSED(dead); } - - QQmlBindEntryContent &operator=(const QQmlBindEntryContent &) = delete; - QQmlBindEntryContent &operator=(QQmlBindEntryContent &&) = delete; }; /*! @@ -191,7 +189,7 @@ private: struct QQmlBindEntry { QQmlBindEntry() = default; - QQmlBindEntry(QQmlBindEntry &&other) : prop(std::move(other.prop)) + QQmlBindEntry(QQmlBindEntry &&other) noexcept : prop(std::move(other.prop)) { currentKind = current.set(std::move(other.current), other.currentKind, currentKind); previousKind = previous.set(std::move(other.previous), other.previousKind, previousKind); @@ -210,7 +208,7 @@ struct QQmlBindEntry previousKind = previous.destroy(previousKind); } - QQmlBindEntry &operator=(QQmlBindEntry &&other) + QQmlBindEntry &operator=(QQmlBindEntry &&other) noexcept { if (this == &other) return *this; |