From d0a58a908825f6f487e6c514b17f634acc034c9e Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 12 Nov 2010 19:08:04 +0000 Subject: QPID-2674: prevent callbacks after doDelete has been called git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1034523 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/DispatchHandle.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cpp/src/qpid') diff --git a/cpp/src/qpid/sys/DispatchHandle.cpp b/cpp/src/qpid/sys/DispatchHandle.cpp index 554fc382ed..5d6fc4e72f 100644 --- a/cpp/src/qpid/sys/DispatchHandle.cpp +++ b/cpp/src/qpid/sys/DispatchHandle.cpp @@ -304,6 +304,15 @@ void DispatchHandle::processEvent(Poller::EventType type) { // (because we use a copy from before the previous callbacks we won't // do anything yet that was just added) while (callbacks.size() > 0) { + { + ScopedLock lock(stateLock); + switch (state) { + case DELETING: + goto finishcallbacks; + default: + break; + } + } Callback cb = callbacks.front(); assert(cb); cb(*this); @@ -315,6 +324,7 @@ void DispatchHandle::processEvent(Poller::EventType type) { // It would be nice to clean up and delete ourselves here, but we can't } +finishcallbacks: { ScopedLock lock(stateLock); switch (state) { -- cgit v1.2.1