changeset 1459:040d58493998

security
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 Jul 2015 15:59:09 +0200
parents 1d109322f5d3
children 6495d08e7985 36143590479d
files OrthancServer/ServerContext.cpp
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp	Thu Jul 02 15:45:55 2015 +0200
+++ b/OrthancServer/ServerContext.cpp	Thu Jul 02 15:59:09 2015 +0200
@@ -132,6 +132,11 @@
   {
     if (!done_)
     {
+      {
+        boost::recursive_mutex::scoped_lock lock(listenersMutex_);
+        listeners_.clear();
+      }
+
       done_ = true;
 
       if (changeThread_.joinable())
@@ -436,10 +441,11 @@
 
   void ServerContext::SetPlugins(OrthancPlugins& plugins)
   {
+    boost::recursive_mutex::scoped_lock lock(listenersMutex_);
+
     plugins_ = &plugins;
 
     // TODO REFACTOR THIS
-    boost::recursive_mutex::scoped_lock lock(listenersMutex_);
     listeners_.clear();
     listeners_.push_back(ServerListener(lua_, "Lua"));
     listeners_.push_back(ServerListener(plugins, "plugin"));
@@ -448,10 +454,11 @@
 
   void ServerContext::ResetPlugins()
   {
+    boost::recursive_mutex::scoped_lock lock(listenersMutex_);
+
     plugins_ = NULL;
 
     // TODO REFACTOR THIS
-    boost::recursive_mutex::scoped_lock lock(listenersMutex_);
     listeners_.clear();
     listeners_.push_back(ServerListener(lua_, "Lua"));
   }