You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2010/05/19 12:21:05 UTC
svn commit: r946106 - /qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
Author: gsim
Date: Wed May 19 10:21:05 2010
New Revision: 946106
URL: http://svn.apache.org/viewvc?rev=946106&view=rev
Log:
Prevent race between shutdown() and release() resulting in attempt to close deleted connector.
Modified:
qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
Modified: qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp?rev=946106&r1=946105&r2=946106&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp Wed May 19 10:21:05 2010
@@ -371,15 +371,24 @@ void ConnectionImpl::release() {
bool isActive;
{
Mutex::ScopedLock l(lock);
- released = true;
isActive = connector && !shutdownComplete;
}
//If we are still active - i.e. associated with an IO thread -
//then we cannot delete ourselves yet, but must wait for the
//shutdown callback which we can trigger by calling
//connector.close()
- if (isActive) connector->close();
- else delete this;
+ if (isActive) {
+ connector->close();
+ bool canDelete;
+ {
+ Mutex::ScopedLock l(lock);
+ released = true;
+ canDelete = shutdownComplete;
+ }
+ if (canDelete) delete this;
+ } else {
+ delete this;
+ }
}
static const std::string CONN_CLOSED("Connection closed");
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org