You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/10/26 21:29:27 UTC

svn commit: r1402626 - /activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp

Author: tabish
Date: Fri Oct 26 19:29:26 2012
New Revision: 1402626

URL: http://svn.apache.org/viewvc?rev=1402626&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-437

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp?rev=1402626&r1=1402625&r2=1402626&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp Fri Oct 26 19:29:26 2012
@@ -81,7 +81,7 @@ void ActiveMQSessionExecutor::executeFir
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQSessionExecutor::wakeup() {
 
-    Pointer<TaskRunner> taskRunner = this->taskRunner;
+    Pointer<TaskRunner> taskRunner;
     synchronized( messageQueue.get() ) {
         if( this->taskRunner == NULL ) {
             this->taskRunner.reset( new DedicatedTaskRunner( this ) );
@@ -110,9 +110,17 @@ void ActiveMQSessionExecutor::stop() {
 
     if( messageQueue->isRunning() ) {
         messageQueue->stop();
-        Pointer<TaskRunner> taskRunner = this->taskRunner;
+
+        Pointer<TaskRunner> taskRunner;
+        synchronized( messageQueue.get() ) {
+        	taskRunner = this->taskRunner;
+
+            if( taskRunner != NULL ) {
+                this->taskRunner.reset( NULL );
+            }
+        }
+
         if( taskRunner != NULL ) {
-            this->taskRunner.reset( NULL );
             taskRunner->shutdown();
         }
     }