qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1227882 - in /qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha: QueueReplicator.cpp QueueReplicator.h
Date Thu, 05 Jan 2012 22:47:07 GMT
Author: aconway
Date: Thu Jan  5 22:47:06 2012
New Revision: 1227882

URL: http://svn.apache.org/viewvc?rev=1227882&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/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/QueueReplicator.h

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/QueueReplicator.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/QueueReplicator.cpp?rev=1227882&r1=1227881&r2=1227882&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/QueueReplicator.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/QueueReplicator.cpp Thu Jan  5 22:47:06 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/qpid/cpp/src/qpid/ha/QueueReplicator.h
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/QueueReplicator.h?rev=1227882&r1=1227881&r2=1227882&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/QueueReplicator.h (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/ha/QueueReplicator.h Thu Jan  5 22:47:06 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


Mime
View raw message