Mercurial > hg > orthanc-object-storage
changeset 151:00cd1f01dd5d
fix initialization and finalization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 21 Jun 2024 10:29:52 +0200 |
parents | 938aee2b5f69 |
children | d62f52be1943 |
files | Aws/AwsS3StoragePlugin.cpp Common/StoragePlugin.cpp |
diffstat | 2 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Aws/AwsS3StoragePlugin.cpp Thu Jun 20 21:58:54 2024 +0200 +++ b/Aws/AwsS3StoragePlugin.cpp Fri Jun 21 10:29:52 2024 +0200 @@ -583,10 +583,10 @@ } catch (const std::exception& e) { + Aws::ShutdownAPI(*sdkOptions_); OrthancPlugins::LogError(std::string("AWS S3 Storage plugin: failed to initialize plugin: ") + e.what()); return nullptr; } - } @@ -595,6 +595,7 @@ assert(sdkOptions_.get() != NULL); Aws::ShutdownAPI(*sdkOptions_); api_.reset(); + sdkOptions_.reset(); }
--- a/Common/StoragePlugin.cpp Thu Jun 20 21:58:54 2024 +0200 +++ b/Common/StoragePlugin.cpp Fri Jun 21 10:29:52 2024 +0200 @@ -530,13 +530,13 @@ { OrthancPlugins::SetGlobalContext(context); - Orthanc::InitializeFramework("", false); +#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 4) + Orthanc::Logging::InitializePluginContext(context, StoragePluginFactory::GetStoragePluginName()); +#elif ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2) Orthanc::Logging::InitializePluginContext(context); - - OrthancPlugins::OrthancConfiguration orthancConfig; - - OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + " plugin is initializing"); - OrthancPlugins::SetDescription(StoragePluginFactory::GetStoragePluginName(), StoragePluginFactory::GetStorageDescription()); +#else + Orthanc::Logging::Initialize(context); +#endif /* Check the version of the Orthanc core */ if (OrthancPluginCheckVersion(context) == 0) @@ -551,6 +551,13 @@ return -1; } + Orthanc::InitializeFramework("", false); + + OrthancPlugins::OrthancConfiguration orthancConfig; + + OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + " plugin is initializing"); + OrthancPlugins::SetDescription(StoragePluginFactory::GetStoragePluginName(), StoragePluginFactory::GetStorageDescription()); + try { const char* pluginSectionName = StoragePluginFactory::GetConfigurationSectionName();