From 210ec8b1363569cd459dd3ce0172eea8e4ef0998 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 21 Feb 2011 11:12:36 +0100 Subject: Fix the move semantics in QSharedDataPointer and QExplicitSDP Reviewed-by: Olivier Goffart --- src/corelib/tools/qshareddata.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 1bdba2c..2b97d2d 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -114,6 +114,7 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS + QSharedDataPointer(QSharedDataPointer &&o) : d(o.d) { o.d = 0; } inline QSharedDataPointer &operator=(QSharedDataPointer &&other) { qSwap(d, other.d); return *this; } #endif @@ -197,7 +198,10 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - inline QSharedDataPointer &operator=(QSharedDataPointer &&other) + inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) : d(o.d) { o.d = 0; } + inline QExplicitlySharedDataPointer &operator=(QExplicitlySharedDataPointer &&other) + { qSwap(d, other.d); return *this; } + inline QExplicitlySharedDataPointer &operator=(QSharedDataPointer &&other) { qSwap(d, other.d); return *this; } #endif -- cgit v0.12