fix: UvHandle move semantics (#43632)

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 <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-09-09 11:52:57 -05:00 committed by GitHub
parent e3908eca41
commit 97f0a9a545
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;