summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-11-12 19:08:04 +0000
committerGordon Sim <gsim@apache.org>2010-11-12 19:08:04 +0000
commit4f27fb7eb4cd34ac379b8d0e5cfd522208239df8 (patch)
tree43f13a025e1be74cd506fd0db5af8adf0c8b9f7b /qpid/cpp/src
parentd0c9efcb701898f204b4373f949079b1fb5f88cd (diff)
downloadqpid-python-4f27fb7eb4cd34ac379b8d0e5cfd522208239df8.tar.gz
QPID-2674: prevent callbacks after doDelete has been called
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1034523 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-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) {