# HG changeset patch # User Sebastien Jodogne # Date 1424261161 -3600 # Node ID b7351ecb79b460784e97214fe75ef019a507c50d # Parent 6ed49334d5c11d99072ea8a925fa2d6873c7ebd2 fix in the plugin destruction diff -r 6ed49334d5c1 -r b7351ecb79b4 OrthancServer/main.cpp --- 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 diff -r 6ed49334d5c1 -r b7351ecb79b4 Plugins/Engine/OrthancPlugins.cpp --- 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 { diff -r 6ed49334d5c1 -r b7351ecb79b4 Plugins/Engine/OrthancPlugins.h --- 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