Skip to content

Commit

Permalink
Problem: Move assigned objects still alive
Browse files Browse the repository at this point in the history
Solution: Close context/socket if move assigned to
  • Loading branch information
gummif committed Dec 5, 2019
1 parent 5ee8261 commit d3abe06
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zmq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ class context_t
context_t(context_t &&rhs) ZMQ_NOTHROW : ptr(rhs.ptr) { rhs.ptr = ZMQ_NULLPTR; }
context_t &operator=(context_t &&rhs) ZMQ_NOTHROW
{
close();
std::swap(ptr, rhs.ptr);
return *this;
}
Expand Down Expand Up @@ -1566,6 +1567,7 @@ class socket_t : public detail::socket_base
}
socket_t &operator=(socket_t &&rhs) ZMQ_NOTHROW
{
close();
std::swap(_handle, rhs._handle);
return *this;
}
Expand Down

0 comments on commit d3abe06

Please sign in to comment.