summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-02-17 14:11:38 +0000
committerAlan Conway <aconway@apache.org>2012-02-17 14:11:38 +0000
commit197f1b9df502f88d1a73cc29d9cc64f7189f7e08 (patch)
treea37f6aa24186aaeb60125e0d4e2b5624a39a7eed
parent7f80263e6394bd19c70f49c7796e8b8a97e942e7 (diff)
downloadqpid-python-197f1b9df502f88d1a73cc29d9cc64f7189f7e08.tar.gz
QPID-3603: Fix QueueReplicator lifecycle, shared pointer cycle.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3603-7@1245517 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/ha/QueueReplicator.cpp5
-rw-r--r--qpid/cpp/src/qpid/ha/QueueReplicator.h1
2 files changed, 1 insertions, 5 deletions
diff --git a/qpid/cpp/src/qpid/ha/QueueReplicator.cpp b/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
index b6f140e86b..0169d0da5b 100644
--- a/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
+++ b/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
@@ -62,9 +62,6 @@ QueueReplicator::QueueReplicator(boost::shared_ptr<Queue> q, boost::shared_ptr<L
// 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())
);
}
diff --git a/qpid/cpp/src/qpid/ha/QueueReplicator.h b/qpid/cpp/src/qpid/ha/QueueReplicator.h
index 4846d01b76..9de7dd480c 100644
--- a/qpid/cpp/src/qpid/ha/QueueReplicator.h
+++ b/qpid/cpp/src/qpid/ha/QueueReplicator.h
@@ -79,7 +79,6 @@ class QueueReplicator : public broker::Exchange,
sys::Mutex lock;
boost::shared_ptr<broker::Queue> queue;
boost::shared_ptr<broker::Link> link;
- boost::shared_ptr<QueueReplicator> self;
};
}} // namespace qpid::ha