diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-09-15 00:36:54 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-09-15 10:10:34 +0000 |
commit | 258e4d05edcb36406c32be56a8207fe992d284dc (patch) | |
tree | 295e02cc3322ff99c4b79b638efa16760ad7f9c3 | |
parent | a54d44298f6d2ecc1ec4d8c5c42c89c8a06fc5dd (diff) |
QDBusError: don't bother dealing with unusable 'unused' field
The move constructor as well as member-swap were dealing with the
'unused' field as if it would be usable. But as the comment in the
default ctor suggests, the field can never be used in Qt 5, due to
the inline dtor.
So, don't bother with the field. Doing so only triggers checkers
such as Coverity.
Also mark the field for removal in Qt 6.
Coverity-Id: 154503
Coverity-Id: 154510
Change-Id: If42c5ed66d1133e651de7477f3313b3989b64bc9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/dbus/qdbuserror.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dbus/qdbuserror.h b/src/dbus/qdbuserror.h index ce5275dee9..12a19a8eda 100644 --- a/src/dbus/qdbuserror.h +++ b/src/dbus/qdbuserror.h @@ -94,8 +94,8 @@ public: QDBusError(const QDBusError &other); #ifdef Q_COMPILER_RVALUE_REFS QDBusError(QDBusError &&other) Q_DECL_NOTHROW - : code(other.code), msg(std::move(other.msg)), nm(std::move(other.nm)), unused(other.unused) - { other.unused = Q_NULLPTR; } + : code(other.code), msg(std::move(other.msg)), nm(std::move(other.nm)) + {} QDBusError &operator=(QDBusError &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif QDBusError &operator=(const QDBusError &other); @@ -108,7 +108,6 @@ public: qSwap(code, other.code); qSwap(msg, other.msg); qSwap(nm, other.nm); - qSwap(unused, other.unused); } ErrorType type() const; @@ -122,6 +121,8 @@ private: ErrorType code; QString msg; QString nm; + // ### This class has an implicit (therefore inline) destructor + // so the following field cannot be used: void *unused; }; Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QDBusError) |