summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qhash.h2
-rw-r--r--src/corelib/tools/qlinkedlist.h2
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qmap.h2
-rw-r--r--src/corelib/tools/qvector.h3
5 files changed, 6 insertions, 5 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index c83dcaabe1..5a4175ec5d 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -249,7 +249,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
QHash(QHash &&other) Q_DECL_NOTHROW : d(other.d) { other.d = const_cast<QHashData *>(&QHashData::shared_null); }
QHash &operator=(QHash &&other) Q_DECL_NOTHROW
- { qSwap(d, other.d); return *this; }
+ { QHash moved(std::move(other)); swap(moved); return *this; }
#endif
void swap(QHash &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 7908bf5137..f216aa121c 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -88,7 +88,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
inline QLinkedList(QLinkedList<T> &&other) : d(other.d) { other.d = const_cast<QLinkedListData *>(&QLinkedListData::shared_null); }
inline QLinkedList<T> &operator=(QLinkedList<T> &&other)
- { qSwap(d, other.d); return *this; }
+ { QLinkedList moved(std::move(other)); swap(moved); return *this; }
#endif
inline void swap(QLinkedList<T> &other) { qSwap(d, other.d); }
bool operator==(const QLinkedList<T> &l) const;
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index b895e7e7b6..e1804e17e5 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -144,7 +144,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
inline QList(QList<T> &&other) : d(other.d) { other.d = const_cast<QListData::Data *>(&QListData::shared_null); }
inline QList &operator=(QList<T> &&other)
- { qSwap(d, other.d); return *this; }
+ { QList moved(std::move(other)); swap(moved); return *this; }
#endif
inline void swap(QList<T> &other) { qSwap(d, other.d); }
#ifdef Q_COMPILER_INITIALIZER_LISTS
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index bf0a36aa88..f3d921c968 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -344,7 +344,7 @@ public:
}
inline QMap<Key, T> &operator=(QMap<Key, T> &&other)
- { qSwap(d, other.d); return *this; }
+ { QMap moved(std::move(other)); swap(moved); return *this; }
#endif
inline void swap(QMap<Key, T> &other) { qSwap(d, other.d); }
explicit QMap(const typename std::map<Key, T> &other);
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 2adb047ed9..624d828a3b 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -70,7 +70,8 @@ public:
QVector<T> &operator=(const QVector<T> &v);
#ifdef Q_COMPILER_RVALUE_REFS
QVector(QVector<T> &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); }
- QVector<T> &operator=(QVector<T> &&other) Q_DECL_NOTHROW { swap(other); return *this; }
+ QVector<T> &operator=(QVector<T> &&other) Q_DECL_NOTHROW
+ { QVector moved(std::move(other)); swap(moved); return *this; }
#endif
void swap(QVector<T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
#ifdef Q_COMPILER_INITIALIZER_LISTS