# HG changeset patch # User Sebastien Jodogne # Date 1718958592 -7200 # Node ID 00cd1f01dd5de97c913057cb48bc89100f6a816d # Parent 938aee2b5f69fccc90da4bce6b84df977d58030e fix initialization and finalization diff -r 938aee2b5f69 -r 00cd1f01dd5d Aws/AwsS3StoragePlugin.cpp --- 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(); } diff -r 938aee2b5f69 -r 00cd1f01dd5d Common/StoragePlugin.cpp --- 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();