From 0228311af67f0577b93710c0cdbc99b10a4cd882 Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Wed, 5 Jan 2022 13:45:04 +0000 Subject: Bug 1747310 - real move assignment operator, r=nss-reviewers,bbeurdouche Differential Revision: https://phabricator.services.mozilla.com/D134818 --- cpputil/databuffer.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cpputil') diff --git a/cpputil/databuffer.h b/cpputil/databuffer.h index d46944d4b..8d34e1a7d 100644 --- a/cpputil/databuffer.h +++ b/cpputil/databuffer.h @@ -32,7 +32,15 @@ class DataBuffer { } return *this; } - DataBuffer& operator=(DataBuffer&&) = default; + DataBuffer& operator=(DataBuffer&& other) { + if (this == &other) { + data_ = other.data_; + len_ = other.len_; + other.data_ = nullptr; + other.len_ = 0; + } + return *this; + } void Allocate(size_t l) { delete[] data_; -- cgit v1.2.1