changeset 1328:b7351ecb79b4

fix in the plugin destruction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Feb 2015 13:06:01 +0100
parents 6ed49334d5c1
children 272cb2019a4c
files OrthancServer/main.cpp Plugins/Engine/OrthancPlugins.cpp Plugins/Engine/OrthancPlugins.h
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Mon Feb 16 12:05:20 2015 +0100
+++ b/OrthancServer/main.cpp	Wed Feb 18 13:06:01 2015 +0100
@@ -481,7 +481,6 @@
 
 #if ENABLE_PLUGINS == 1
     orthancPlugins.SetServerContext(*context);
-    orthancPlugins.SetOrthancRestApi(restApi);
     httpServer.RegisterHandler(orthancPlugins);
     context->SetOrthancPlugins(pluginsManager, orthancPlugins);
 #endif
@@ -509,6 +508,10 @@
     // GO !!! Start the requested servers
     if (Configuration::GetGlobalBoolParameter("HttpServerEnabled", true))
     {
+#if ENABLE_PLUGINS == 1
+      orthancPlugins.SetOrthancRestApi(restApi);
+#endif
+
       httpServer.Start();
       LOG(WARNING) << "HTTP server listening on port: " << httpServer.GetPortNumber();
     }
@@ -542,6 +545,7 @@
 #if ENABLE_PLUGINS == 1
     context->ResetOrthancPlugins();
     orthancPlugins.Stop();
+    orthancPlugins.ResetOrthancRestApi();
     LOG(WARNING) << "    Plugins have stopped";
 #endif
 
--- a/Plugins/Engine/OrthancPlugins.cpp	Mon Feb 16 12:05:20 2015 +0100
+++ b/Plugins/Engine/OrthancPlugins.cpp	Wed Feb 18 13:06:01 2015 +0100
@@ -1201,6 +1201,12 @@
     pimpl_->restApi_ = &restApi;
   }
 
+
+  void  OrthancPlugins::ResetOrthancRestApi()
+  {
+    pimpl_->restApi_ = NULL;
+  }
+
   
   bool OrthancPlugins::HasStorageArea() const
   {
--- a/Plugins/Engine/OrthancPlugins.h	Mon Feb 16 12:05:20 2015 +0100
+++ b/Plugins/Engine/OrthancPlugins.h	Wed Feb 18 13:06:01 2015 +0100
@@ -110,6 +110,8 @@
 
     void SetOrthancRestApi(OrthancRestApi& restApi);
 
+    void ResetOrthancRestApi();
+
     bool HasStorageArea() const;
 
     IStorageArea* GetStorageArea();  // To be freed after use