You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/10/02 16:26:00 UTC

svn commit: r1392926 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp

Author: tabish
Date: Tue Oct  2 14:25:59 2012
New Revision: 1392926

URL: http://svn.apache.org/viewvc?rev=1392926&view=rev
Log:
Add small fix to ensure concurrent close from client and onException doesn't step into NULL transport. 

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?rev=1392926&r1=1392925&r2=1392926&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp Tue Oct  2 14:25:59 2012
@@ -297,9 +297,12 @@ namespace core{
                 // Mark this Connection as having a Failed transport.
                 this->connection->setFirstFailureError(ex);
 
-                try{
-                    this->config->transport->stop();
-                } catch(...) {
+                Pointer<Transport> transport = this->config->transport;
+                if (transport != NULL) {
+                    try {
+                        transport->stop();
+                    } catch(...) {
+                    }
                 }
 
                 this->config->brokerInfoReceived->countDown();
@@ -310,7 +313,7 @@ namespace core{
                 synchronized(&this->config->transportListeners) {
                     Pointer< Iterator<TransportListener*> > iter( this->config->transportListeners.iterator() );
 
-                    while( iter->hasNext() ) {
+                    while (iter->hasNext()) {
                         try{
                             iter->next()->onException(ex);
                         } catch(...) {}