Author: aconway
Date: Fri Feb 17 14:11:38 2012
New Revision: 1245517

URL: http://svn.apache.org/viewvc?rev=1245517&view=rev
Log:
QPID-3603: Fix QueueReplicator lifecycle, shared pointer cycle.

Modified:
    qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
    qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.h

Modified: qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.cpp?rev=1245517&r1=1245516&r2=1245517&view=diff
==============================================================================
--- qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.cpp 
(original)
+++ qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.cpp Fri Feb 
17 14:11:38 2012
@@ -62,9 +62,6 @@ QueueReplicator::QueueReplicator(boost::
 
 // This must be separate from the constructor so we can call shared_from_this.
 void QueueReplicator::activate() {
-    // Take a reference to myself to ensure not deleted before initializeBridge
-    // is called.
-    self = shared_from_this();
     // Note this may create a new bridge or use an existing one.
     queue->getBroker()->getLinks().declare(
         link->getHost(), link->getPort(),
@@ -80,7 +77,7 @@ void QueueReplicator::activate() {
         0,                  // sync?
         // Include shared_ptr to self to ensure we are not deleted
         // before initializeBridge is called.
-        boost::bind(&QueueReplicator::initializeBridge, this, _1, _2, self)
+        boost::bind(&QueueReplicator::initializeBridge, this, _1, _2, 
shared_from_this())
     );
 }
 

Modified: qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.h
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.h?rev=1245517&r1=1245516&r2=1245517&view=diff
==============================================================================
--- qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.h (original)
+++ qpid/branches/qpid-3603-7/qpid/cpp/src/qpid/ha/QueueReplicator.h Fri Feb 17 
14:11:38 2012
@@ -79,7 +79,6 @@ class QueueReplicator : public broker::E
     sys::Mutex lock;
     boost::shared_ptr<broker::Queue> queue;
     boost::shared_ptr<broker::Link> link;
-    boost::shared_ptr<QueueReplicator> self;
 };
 
 }} // namespace qpid::ha



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org

Reply via email to