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 <charles@charleskerr.com>
This commit is contained in:
parent
8d9ed52c72
commit
67da1f2f9f
1 changed files with 11 additions and 2 deletions
|
@ -62,8 +62,17 @@ class UvHandle {
|
||||||
UvHandle() : t_{new T} {}
|
UvHandle() : t_{new T} {}
|
||||||
~UvHandle() { reset(); }
|
~UvHandle() { reset(); }
|
||||||
|
|
||||||
UvHandle(UvHandle&&) = default;
|
explicit UvHandle(UvHandle&& that) {
|
||||||
UvHandle& operator=(UvHandle&&) = default;
|
t_ = that.t_;
|
||||||
|
that.t_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
UvHandle& operator=(UvHandle&& that) {
|
||||||
|
reset();
|
||||||
|
t_ = that.t_;
|
||||||
|
that.t_ = nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
UvHandle(const UvHandle&) = delete;
|
UvHandle(const UvHandle&) = delete;
|
||||||
UvHandle& operator=(const UvHandle&) = delete;
|
UvHandle& operator=(const UvHandle&) = delete;
|
||||||
|
|
Loading…
Reference in a new issue