From a1d4ec4615b6cb6c54b1e6473a0cd0e4d4161b43 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@832233 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/Queue.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp index b76581c60d..f260482db9 100644 --- a/qpid/cpp/src/qpid/broker/Queue.cpp +++ b/qpid/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