mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-13 10:52:57 +01:00
Problem: Move assigned objects still alive
Solution: Close context/socket if move assigned to
This commit is contained in:
parent
5ee8261743
commit
d3abe06ba3
2
zmq.hpp
2
zmq.hpp
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user