changeset 1223:5bd4c9f85b4c

fix race condition while unregistering plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Nov 2014 11:52:40 +0100
parents 410c27e04a23
children 29cf3dd2cea4
files OrthancServer/ServerContext.h OrthancServer/main.cpp
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/ServerContext.h	Tue Nov 11 09:57:42 2014 +0100
+++ b/OrthancServer/ServerContext.h	Wed Nov 12 11:52:40 2014 +0100
@@ -200,6 +200,11 @@
       plugins_ = &plugins;
     }
 
+    void ResetOrthancPlugins()
+    {
+      plugins_ = NULL;
+    }
+
     bool DeleteResource(Json::Value& target,
                         const std::string& uuid,
                         ResourceType expectedType);
--- a/OrthancServer/main.cpp	Tue Nov 11 09:57:42 2014 +0100
+++ b/OrthancServer/main.cpp	Wed Nov 12 11:52:40 2014 +0100
@@ -586,6 +586,7 @@
     LOG(WARNING) << "Orthanc is stopping";
 
 #if ENABLE_PLUGINS == 1
+    context.ResetOrthancPlugins();
     orthancPlugins.Stop();
     LOG(WARNING) << "    Plugins have stopped";
 #endif
@@ -701,7 +702,7 @@
   }
   catch (...)
   {
-    LOG(ERROR) << "Native exception, stopping now";
+    LOG(ERROR) << "Native exception, stopping now. Check your plugins, if any.";
     status = -1;
   }