From e8fe25bc6121d399535458d5928a15a760b183bf Mon Sep 17 00:00:00 2001 From: Dominik Gleich Date: Thu, 6 Apr 2017 14:14:19 +0200 Subject: [PATCH] Remove move constructor and delete move = Reviewers: florijan, mislav.bradac Reviewed By: mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D237 --- src/mvcc/version_list.hpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/mvcc/version_list.hpp b/src/mvcc/version_list.hpp index 84aad96fe..134110ab6 100644 --- a/src/mvcc/version_list.hpp +++ b/src/mvcc/version_list.hpp @@ -35,15 +35,13 @@ class VersionList { VersionList() = delete; VersionList(const VersionList &) = delete; VersionList &operator=(const VersionList &) = delete; - - /* @brief Move constructs the version list - * Note: use only at the beginning of the "other's" lifecycle since this - * constructor doesn't move the RecordLock, but only the head pointer - */ - VersionList(VersionList &&other) { - this->head = other.head.load(); - other.head = nullptr; - } + // We do a lot of raw-pointer ops with VLists, and these ops assume that a + // VList's address identifies a vertex/edge absolutely and during it's whole + // lifteme. We also assume that the VList owner is the database and that + // ownership is also handled via raw pointers so this shouldn't be moved or + // move assigned. + VersionList(const VersionList &&other) = delete; + VersionList &operator=(const VersionList &&other) = delete; ~VersionList() { delete head.load(); } @@ -154,8 +152,7 @@ class VersionList { new_ref = nullptr; old_ref = head.load(std::memory_order_seq_cst); while (old_ref != nullptr && !old_ref->visible(t)) { - if (!new_ref && old_ref->is_created_by(t)) - new_ref = old_ref; + if (!new_ref && old_ref->is_created_by(t)) new_ref = old_ref; old_ref = old_ref->next(std::memory_order_seq_cst); } }