Skip to content

Commit 7faa9b0

Browse files
authored
Merge pull request #85 from serge-medvedev/context-close-destruct-assert-issue
Failing assertion in dtor of context_t
2 parents 92d2af6 + 8214a50 commit 7faa9b0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

zmq.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,17 @@ namespace zmq
410410

411411
inline ~context_t () ZMQ_NOTHROW
412412
{
413-
int rc = zmq_ctx_destroy (ptr);
414-
ZMQ_ASSERT (rc == 0);
413+
close();
415414
}
416415

417416
inline void close() ZMQ_NOTHROW
418417
{
418+
if (ptr == NULL)
419+
return;
420+
419421
int rc = zmq_ctx_destroy (ptr);
420422
ZMQ_ASSERT (rc == 0);
423+
ptr = NULL;
421424
}
422425

423426
// Be careful with this, it's probably only useful for

0 commit comments

Comments
 (0)