You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2012/02/14 17:05:39 UTC
svn commit: r1244060 - in /qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha:
QueueReplicator.cpp QueueReplicator.h
Author: aconway
Date: Tue Feb 14 16:05:39 2012
New Revision: 1244060
URL: http://svn.apache.org/viewvc?rev=1244060&view=rev
Log:
QPID-3603: Fix initialization race in QueueReplicator.
Was core dumping occasionally due to QueueReplicator being deleted before
it was initialized.
Modified:
qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.h
Modified: qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.cpp?rev=1244060&r1=1244059&r2=1244060&view=diff
==============================================================================
--- qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.cpp (original)
+++ qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.cpp Tue Feb 14 16:05:39 2012
@@ -78,7 +78,7 @@ void QueueReplicator::activate() {
false, // dynamic
0, // sync?
// Include shared_ptr to self to ensure we not deleted before initializeBridge is called.
- boost::bind(&QueueReplicator::initializeBridge, this, _1, _2)
+ boost::bind(&QueueReplicator::initializeBridge, this, _1, _2, self)
);
}
@@ -91,7 +91,9 @@ void QueueReplicator::deactivate() {
}
// Called in a broker connection thread when the bridge is created.
-void QueueReplicator::initializeBridge(Bridge& bridge, SessionHandler& sessionHandler) {
+// shared_ptr to self ensures we are not deleted before initializeBridge is called.
+void QueueReplicator::initializeBridge(Bridge& bridge, SessionHandler& sessionHandler,
+ boost::shared_ptr<QueueReplicator> /*self*/) {
sys::Mutex::ScopedLock l(lock);
framing::AMQP_ServerProxy peer(sessionHandler.out);
Modified: qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.h
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.h?rev=1244060&r1=1244059&r2=1244060&view=diff
==============================================================================
--- qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.h (original)
+++ qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/ha/QueueReplicator.h Tue Feb 14 16:05:39 2012
@@ -70,7 +70,8 @@ class QueueReplicator : public broker::E
bool isBound(boost::shared_ptr<broker::Queue>, const std::string* const, const framing::FieldTable* const);
private:
- void initializeBridge(broker::Bridge& bridge, broker::SessionHandler& sessionHandler);
+ void initializeBridge(broker::Bridge& bridge, broker::SessionHandler& sessionHandler,
+ boost::shared_ptr<QueueReplicator> self);
void dequeue(framing::SequenceNumber, const sys::Mutex::ScopedLock&);
std::string logPrefix;
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org