From b0d51a6f36ac47118da4995cb7ddd7d32847f320 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sat, 15 Jan 2022 11:08:08 +0100 Subject: [PATCH] AK: Fix erroneous move operators for SinglyLinkedList This patch provides a proper implementation of the move operator and delete the move assignment operator. Those operators were introduced in #11888 --- AK/SinglyLinkedList.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/AK/SinglyLinkedList.h b/AK/SinglyLinkedList.h index 99ac7e0982..513215e374 100644 --- a/AK/SinglyLinkedList.h +++ b/AK/SinglyLinkedList.h @@ -81,9 +81,15 @@ private: public: SinglyLinkedList() = default; SinglyLinkedList(const SinglyLinkedList& other) = delete; - SinglyLinkedList(SinglyLinkedList&&) = default; + SinglyLinkedList(SinglyLinkedList&& other) + : m_head(other.m_head) + , m_tail(other.m_tail) + { + other.m_head = nullptr; + other.m_tail = nullptr; + } SinglyLinkedList& operator=(const SinglyLinkedList& other) = delete; - SinglyLinkedList& operator=(SinglyLinkedList&&) = default; + SinglyLinkedList& operator=(SinglyLinkedList&&) = delete; ~SinglyLinkedList() { clear(); }