From 8a13aa0e02c4709677efd07df00ec24c42c7b424 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 8 Jul 2020 14:42:35 +0200 Subject: [PATCH] QArrayDataPointer: use move and swap in move assignment Not plain swap; QADP does not hold just memory but arbitrary state (depending on T). Change-Id: I3560577e4109607a51b2c72b67e22e38813977b3 Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydatapointer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index a7e8429469a..bb24f3e6f2c 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -103,7 +103,8 @@ public: QArrayDataPointer &operator=(QArrayDataPointer &&other) noexcept { - this->swap(other); + QArrayDataPointer moved(std::move(other)); + swap(moved); return *this; }