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:25:14 UTC

svn commit: r1402621 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp

Author: tabish
Date: Fri Oct 26 19:25:13 2012
New Revision: 1402621

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

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp?rev=1402621&r1=1402620&r2=1402621&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp Fri Oct 26 19:25:13 2012
@@ -83,7 +83,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));
@@ -111,9 +111,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();
         }
     }