activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r740967 - in /activemq/activemq-cpp/trunk/src/main/activemq/transport/mock: MockTransport.cpp MockTransport.h MockTransportFactory.cpp
Date Thu, 05 Feb 2009 01:33:47 GMT
Author: tabish
Date: Thu Feb  5 01:33:46 2009
New Revision: 740967

URL: http://svn.apache.org/viewvc?rev=740967&view=rev
Log:
Fix some memory leaks

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransportFactory.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp?rev=740967&r1=740966&r2=740967&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp Thu Feb
 5 01:33:46 2009
@@ -22,6 +22,7 @@
 using namespace activemq::transport;
 using namespace activemq::transport::mock;
 using namespace activemq::exceptions;
+using namespace activemq::wireformat;
 using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
@@ -29,9 +30,9 @@
 MockTransport* MockTransport::instance = NULL;
 
 ////////////////////////////////////////////////////////////////////////////////
-MockTransport::MockTransport( ResponseBuilder* responseBuilder ,
-                              bool own ){
+MockTransport::MockTransport( WireFormat* wireFormat, ResponseBuilder* responseBuilder, bool
own ){
 
+    this->wireFormat = wireFormat;
     this->responseBuilder = NULL;
     this->outgoingListener = NULL;
     this->listener = NULL;
@@ -49,9 +50,11 @@
 MockTransport::~MockTransport(){
     try{
 
-        if( own ){
-            delete responseBuilder;
+        if( this->own ){
+            delete this->responseBuilder;
         }
+
+        delete this->wireFormat;
     }
     AMQ_CATCHALL_NOTHROW()
 }

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h?rev=740967&r1=740966&r2=740967&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h Thu Feb 
5 01:33:46 2009
@@ -24,6 +24,7 @@
 #include <activemq/transport/TransportListener.h>
 #include <activemq/transport/DefaultTransportListener.h>
 #include <activemq/transport/CommandIOException.h>
+#include <activemq/wireformat/WireFormat.h>
 
 #include <decaf/lang/Thread.h>
 #include <decaf/util/Queue.h>
@@ -179,6 +180,7 @@
         ResponseBuilder* responseBuilder;
         TransportListener* outgoingListener;
         TransportListener* listener;
+        wireformat::WireFormat* wireFormat;
         decaf::util::concurrent::atomic::AtomicInteger nextCommandId;
         bool own;
         InternalCommandListener internalListener;
@@ -186,7 +188,7 @@
 
     public:
 
-        MockTransport( ResponseBuilder* responseBuilder, bool own = false );
+        MockTransport( wireformat::WireFormat* wireFormat, ResponseBuilder* responseBuilder,
bool own = true );
 
         virtual ~MockTransport();
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransportFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransportFactory.cpp?rev=740967&r1=740966&r2=740967&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransportFactory.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransportFactory.cpp
Thu Feb  5 01:33:46 2009
@@ -31,24 +31,24 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 Transport* MockTransportFactory::doCreateComposite( const decaf::net::URI& location AMQCPP_UNUSED,
-                                                    wireformat::WireFormat* wireFormat AMQCPP_UNUSED,
+                                                    wireformat::WireFormat* wireFormat,
                                                     const decaf::util::Properties& properties
)
     throw ( exceptions::ActiveMQException ) {
 
     try {
 
-        std::string wireFormat =
+        std::string wireFormatName =
             properties.getProperty( "wireFormat", "stomp" );
 
         MockTransport::ResponseBuilder* builder = NULL;
 
-        if( wireFormat == "stomp" ) {
+        if( wireFormatName == "stomp" ) {
 //            builder = new wireformat::stomp::StompResponseBuilder();
-        } else if( wireFormat == "openwire" ) {
+        } else if( wireFormatName == "openwire" ) {
             builder = new wireformat::openwire::OpenWireResponseBuilder();
         }
 
-        return new MockTransport( builder, true );
+        return new MockTransport( wireFormat, builder, true );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )



Mime
View raw message