From bbf3934497e7c95f2b90b59dbef7c5adc810ce7b Mon Sep 17 00:00:00 2001 From: Kenneth Anthony Giusti Date: Thu, 4 Aug 2011 18:45:16 +0000 Subject: QPID-3394: move object copy after changing object state, not before. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1153966 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/SessionState.cpp | 5 ++--- cpp/src/qpid/broker/SessionState.h | 10 +++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/broker/SessionState.cpp b/cpp/src/qpid/broker/SessionState.cpp index ee9646931e..742dbe9be8 100644 --- a/cpp/src/qpid/broker/SessionState.cpp +++ b/cpp/src/qpid/broker/SessionState.cpp @@ -445,8 +445,6 @@ void SessionState::addPendingExecutionSync() boost::intrusive_ptr SessionState::IncompleteIngressMsgXfer::clone() { - boost::intrusive_ptr cb(new SessionState::IncompleteIngressMsgXfer(session, msg)); - // Optimization: this routine is *only* invoked when the message needs to be asynchronously completed. // If the client is pending the message.transfer completion, flush now to force immediate write to journal. if (requiresSync) @@ -457,7 +455,8 @@ SessionState::IncompleteIngressMsgXfer::clone() pending = true; completerContext->addPendingMessage(msg); } - return cb; + + return boost::intrusive_ptr(new SessionState::IncompleteIngressMsgXfer(*this)); } diff --git a/cpp/src/qpid/broker/SessionState.h b/cpp/src/qpid/broker/SessionState.h index b43df0c0aa..506af85c47 100644 --- a/cpp/src/qpid/broker/SessionState.h +++ b/cpp/src/qpid/broker/SessionState.h @@ -256,7 +256,15 @@ class SessionState : public qpid::SessionState, requiresAccept(m->requiresAccept()), requiresSync(m->getFrames().getMethod()->isSync()), pending(false) {} - virtual ~IncompleteIngressMsgXfer() {}; + IncompleteIngressMsgXfer( const IncompleteIngressMsgXfer& x ) + : AsyncCommandContext(x.session, x.msg->getCommandId()), + session(x.session), + msg(x.msg), + requiresAccept(x.requiresAccept), + requiresSync(x.requiresSync), + pending(x.pending) {} + + virtual ~IncompleteIngressMsgXfer() {}; virtual void completed(bool); virtual boost::intrusive_ptr clone(); -- cgit v1.2.1