mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-05-29 15:34:09 +02:00
Assertion in dtor of context_t doesn't fail if close method has already been called
This commit is contained in:
parent
92d2af6def
commit
8214a500d9
7
zmq.hpp
7
zmq.hpp
@ -410,14 +410,17 @@ namespace zmq
|
|||||||
|
|
||||||
inline ~context_t () ZMQ_NOTHROW
|
inline ~context_t () ZMQ_NOTHROW
|
||||||
{
|
{
|
||||||
int rc = zmq_ctx_destroy (ptr);
|
close();
|
||||||
ZMQ_ASSERT (rc == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void close() ZMQ_NOTHROW
|
inline void close() ZMQ_NOTHROW
|
||||||
{
|
{
|
||||||
|
if (ptr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
int rc = zmq_ctx_destroy (ptr);
|
int rc = zmq_ctx_destroy (ptr);
|
||||||
ZMQ_ASSERT (rc == 0);
|
ZMQ_ASSERT (rc == 0);
|
||||||
|
ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Be careful with this, it's probably only useful for
|
// Be careful with this, it's probably only useful for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user