changeset 1809:5ed8769b17f9 worklists

disable worklist support if no plugin has registered callbacks
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 23 Nov 2015 17:02:42 +0100
parents 9c2ffc4e938b
children 796d0b087fb8
files OrthancServer/main.cpp Plugins/Engine/OrthancPlugins.cpp Plugins/Engine/OrthancPlugins.h
diffstat 3 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Mon Nov 23 16:58:55 2015 +0100
+++ b/OrthancServer/main.cpp	Mon Nov 23 17:02:42 2015 +0100
@@ -736,7 +736,8 @@
   dicomServer.SetFindRequestHandlerFactory(serverFactory);
 
 #if ORTHANC_PLUGINS_ENABLED == 1
-  if (plugins)
+  if (plugins &&
+      plugins->HasWorklistHandler())
   {
     dicomServer.SetWorklistRequestHandlerFactory(*plugins);
   }
--- a/Plugins/Engine/OrthancPlugins.cpp	Mon Nov 23 16:58:55 2015 +0100
+++ b/Plugins/Engine/OrthancPlugins.cpp	Mon Nov 23 17:02:42 2015 +0100
@@ -2085,14 +2085,7 @@
 
   IWorklistRequestHandler* OrthancPlugins::ConstructWorklistRequestHandler()
   {
-    bool hasHandler;
-
-    {
-      boost::recursive_mutex::scoped_lock lock(pimpl_->worklistCallbackMutex_);
-      hasHandler = !pimpl_->worklistCallbacks_.empty();
-    }
-
-    if (hasHandler)
+    if (HasWorklistHandler())
     {
       return new WorklistHandler(*this);
     }
@@ -2101,4 +2094,12 @@
       return NULL;
     }
   }
+
+
+  bool OrthancPlugins::HasWorklistHandler()
+  {
+    boost::recursive_mutex::scoped_lock lock(pimpl_->worklistCallbackMutex_);
+    return !pimpl_->worklistCallbacks_.empty();
+  }
+
 }
--- a/Plugins/Engine/OrthancPlugins.h	Mon Nov 23 16:58:55 2015 +0100
+++ b/Plugins/Engine/OrthancPlugins.h	Mon Nov 23 17:02:42 2015 +0100
@@ -211,6 +211,7 @@
       SignalChangeInternal(OrthancPluginChangeType_OrthancStopped, OrthancPluginResourceType_None, NULL);
     }
 
+    bool HasWorklistHandler();
 
     virtual IWorklistRequestHandler* ConstructWorklistRequestHandler();
   };