You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2010/11/12 19:54:27 UTC

svn commit: r1034510 - /qpid/branches/0.8-release-candidates/qpid/cpp/src/qpid/sys/DispatchHandle.cpp

Author: gsim
Date: Fri Nov 12 18:54:27 2010
New Revision: 1034510

URL: http://svn.apache.org/viewvc?rev=1034510&view=rev
Log:
QPID-2674: prevent callbacks after doDelete has been called

Modified:
    qpid/branches/0.8-release-candidates/qpid/cpp/src/qpid/sys/DispatchHandle.cpp

Modified: qpid/branches/0.8-release-candidates/qpid/cpp/src/qpid/sys/DispatchHandle.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.8-release-candidates/qpid/cpp/src/qpid/sys/DispatchHandle.cpp?rev=1034510&r1=1034509&r2=1034510&view=diff
==============================================================================
--- qpid/branches/0.8-release-candidates/qpid/cpp/src/qpid/sys/DispatchHandle.cpp (original)
+++ qpid/branches/0.8-release-candidates/qpid/cpp/src/qpid/sys/DispatchHandle.cpp Fri Nov 12 18:54:27 2010
@@ -304,6 +304,15 @@ void DispatchHandle::processEvent(Poller
     // (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
         // It would be nice to clean up and delete ourselves here, but we can't
     }
 
+finishcallbacks:
     {
     ScopedLock<Mutex> lock(stateLock);
     switch (state) {



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org