diff --git a/src/common/lock_manager.h b/src/common/lock_manager.h index 782d6c8254a..985d5efc8ce 100644 --- a/src/common/lock_manager.h +++ b/src/common/lock_manager.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -125,7 +126,14 @@ class MultiLockGuard { MultiLockGuard(const MultiLockGuard &) = delete; MultiLockGuard &operator=(const MultiLockGuard &) = delete; - MultiLockGuard(MultiLockGuard &&guard) : locks_(std::move(guard.locks_)) {} + MultiLockGuard(MultiLockGuard &&guard) : locks_(std::move(guard.locks_)) { guard.locks_.clear(); } + MultiLockGuard &operator=(MultiLockGuard &&other) noexcept { + if (this != &other) { + std::destroy_at(this); + new (this) MultiLockGuard(std::move(other)); + } + return *this; + } private: std::vector locks_;