From 67da1f2f9ff1f65ae3ed6e3c1195d567030f8163 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:35:58 -0500 Subject: [PATCH] fix: UvHandle move semantics (#43634) reassign the uv_handle_t of the source Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr --- shell/common/node_bindings.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/shell/common/node_bindings.h b/shell/common/node_bindings.h index ac6faf470a00..a870e97c1fd5 100644 --- a/shell/common/node_bindings.h +++ b/shell/common/node_bindings.h @@ -62,8 +62,17 @@ class UvHandle { UvHandle() : t_{new T} {} ~UvHandle() { reset(); } - UvHandle(UvHandle&&) = default; - UvHandle& operator=(UvHandle&&) = default; + explicit UvHandle(UvHandle&& that) { + t_ = that.t_; + that.t_ = nullptr; + } + + UvHandle& operator=(UvHandle&& that) { + reset(); + t_ = that.t_; + that.t_ = nullptr; + return *this; + } UvHandle(const UvHandle&) = delete; UvHandle& operator=(const UvHandle&) = delete;