From 8cb44915d865d11f5156ef0ca1585875155d1635 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:36:11 -0500 Subject: [PATCH] fix: UvHandle move semantics (#43633) 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 196aa624c996..e20bb2e04761 100644 --- a/shell/common/node_bindings.h +++ b/shell/common/node_bindings.h @@ -58,8 +58,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;