summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-11-12 18:54:27 +0000
committerGordon Sim <gsim@apache.org>2010-11-12 18:54:27 +0000
commit25cd1a320682c4c13b9a0eca3bd57f1b0bec5c67 (patch)
treec891c47aa7eec2b0aa9df8d6a173314a02e8d7e4
parentbbd94f116d039b6a848a0e4ce2cf8653deefe089 (diff)
downloadqpid-python-25cd1a320682c4c13b9a0eca3bd57f1b0bec5c67.tar.gz
QPID-2674: prevent callbacks after doDelete has been called
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.8-release-candidates@1034510 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/sys/DispatchHandle.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/sys/DispatchHandle.cpp b/qpid/cpp/src/qpid/sys/DispatchHandle.cpp
index 554fc382ed..5d6fc4e72f 100644
--- a/qpid/cpp/src/qpid/sys/DispatchHandle.cpp
+++ b/qpid/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<Mutex> 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<Mutex> lock(stateLock);
switch (state) {