From ae3b13c693bab1a66d4a5d72873869fd128e32a3 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Tue, 3 Nov 2009 00:49:30 +0000 Subject: Erasing an iterator invalidates the iterator; changed the code to not dereference an iterator that was just deleted. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@832233 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/Queue.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index b76581c60d..f260482db9 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -249,8 +249,9 @@ bool Queue::acquireMessageAt(const SequenceNumber& position, QueuedMessage& mess if (lastValueQueue) { clearLVQIndex(*i); } + QPID_LOG(debug, + "Acquired message at " << i->position << " from " << name); messages.erase(i); - QPID_LOG(debug, "Acquired message at " << i->position << " from " << name); return true; } } @@ -267,8 +268,10 @@ bool Queue::acquire(const QueuedMessage& msg) { msg.payload.get() == checkLvqReplace(*i).payload.get()) ) { clearLVQIndex(msg); + QPID_LOG(debug, + "Match found, acquire succeeded: " << + i->position << " == " << msg.position); messages.erase(i); - QPID_LOG(debug, "Match found, acquire succeeded: " << i->position << " == " << msg.position); return true; } else { QPID_LOG(debug, "No match: " << i->position << " != " << msg.position); -- cgit v1.2.1