diff --git a/zmq.hpp b/zmq.hpp index 1b7c8a6..c804b37 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -236,11 +236,17 @@ namespace zmq #endif inline ~context_t () + { + close(); + } + + inline void close() { if (ptr == NULL) return; int rc = zmq_term (ptr); ZMQ_ASSERT (rc == 0); + ptr = NULL; } // Be careful with this, it's probably only useful for