diff options
author | Gordon Sim <gsim@apache.org> | 2010-03-19 17:04:18 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2010-03-19 17:04:18 +0000 |
commit | 45b5d1cc1f48ed8f6caef8ee9652f788d69747a5 (patch) | |
tree | 285eebffee4dd1252abde2dd39872531565987d3 /cpp/include | |
parent | d6de561675087e8b1a6978d82569467c4aeff398 (diff) | |
download | qpid-python-45b5d1cc1f48ed8f6caef8ee9652f788d69747a5.tar.gz |
QPID-664: Prevent dangling pointers when receiver/sender handles stay in scope after connection/session handles goes out of scope. This change require connections to be closed explicitly to avoid leaking memory.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@925332 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include')
-rw-r--r-- | cpp/include/qpid/messaging/Connection.h | 5 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Session.h | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/cpp/include/qpid/messaging/Connection.h b/cpp/include/qpid/messaging/Connection.h index 7f324cea1e..b5eeeb2980 100644 --- a/cpp/include/qpid/messaging/Connection.h +++ b/cpp/include/qpid/messaging/Connection.h @@ -80,6 +80,11 @@ class Connection : public qpid::messaging::Handle<ConnectionImpl> QPID_CLIENT_EXTERN Connection& operator=(const Connection&); QPID_CLIENT_EXTERN void setOption(const std::string& name, const Variant& value); QPID_CLIENT_EXTERN void open(const std::string& url); + /** + * Closes a connection and all sessions associated with it. An + * opened connection must be closed before the last handle is + * allowed to go out of scope. + */ QPID_CLIENT_EXTERN void close(); QPID_CLIENT_EXTERN Session newSession(bool transactional, const std::string& name = std::string()); QPID_CLIENT_EXTERN Session newSession(const std::string& name = std::string()); diff --git a/cpp/include/qpid/messaging/Session.h b/cpp/include/qpid/messaging/Session.h index 5375b4d346..032b678c5c 100644 --- a/cpp/include/qpid/messaging/Session.h +++ b/cpp/include/qpid/messaging/Session.h @@ -58,6 +58,12 @@ class Session : public qpid::messaging::Handle<SessionImpl> QPID_CLIENT_EXTERN ~Session(); QPID_CLIENT_EXTERN Session& operator=(const Session&); + /** + * Closes a session and all associated senders and receivers. An + * opened session should be closed before the last handle to it + * goes out of scope. All a connections sessions can be closed by + * a call to Connection::close(). + */ QPID_CLIENT_EXTERN void close(); QPID_CLIENT_EXTERN void commit(); |