diff options
| author | Gordon Sim <gsim@apache.org> | 2010-11-12 19:08:04 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2010-11-12 19:08:04 +0000 |
| commit | d0a58a908825f6f487e6c514b17f634acc034c9e (patch) | |
| tree | 63edcd8123a18c0f1fcbac9c63706d61ff4fc395 /cpp/src/qpid | |
| parent | cbb1f8f1b00088d24ac3951e8230bc65984cda3d (diff) | |
| download | qpid-python-d0a58a908825f6f487e6c514b17f634acc034c9e.tar.gz | |
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
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/sys/DispatchHandle.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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<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) { |
