activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r757490 - in /activemq/activemq-cpp/trunk/src/main/activemq/transport: IOTransport.cpp IOTransport.h
Date Mon, 23 Mar 2009 18:35:31 GMT
Author: tabish
Date: Mon Mar 23 18:35:31 2009
New Revision: 757490

URL: http://svn.apache.org/viewvc?rev=757490&view=rev
Log:
Fix a possible memory leak were thread handles could be lost if an exception happens early
in the close method.

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp?rev=757490&r1=757489&r2=757490&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp Mon Mar 23 18:35:31
2009
@@ -44,7 +44,6 @@
     this->inputStream = NULL;
     this->outputStream = NULL;
     this->closed = false;
-    this->thread = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -54,7 +53,6 @@
     this->inputStream = NULL;
     this->outputStream = NULL;
     this->closed = false;
-    this->thread = NULL;
     this->wireFormat = wireFormat;
 }
 
@@ -164,7 +162,7 @@
         }
 
         // Start the polling thread.
-        thread = new Thread( this );
+        thread.reset( new Thread( this ) );
         thread->start();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -197,8 +195,7 @@
         // Wait for the thread to die.
         if( thread != NULL ){
             thread->join();
-            delete thread;
-            thread = NULL;
+            thread.reset( NULL );
         }
 
         // Close the output stream.

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h?rev=757490&r1=757489&r2=757490&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h Mon Mar 23 18:35:31
2009
@@ -82,7 +82,7 @@
         /**
          * The polling thread.
          */
-        decaf::lang::Thread* thread;
+        Pointer<decaf::lang::Thread> thread;
 
         /**
          * Flag marking this transport as closed.



Mime
View raw message