# HG changeset patch # User Alain Mazy # Date 1699430112 -3600 # Node ID 93c6f12bf339d3c7250d4002162c76027b414f50 # Parent d63c58d650ffcb40b836b9d95e93933107cf4327 improved support for /reset but still not ok diff -r d63c58d650ff -r 93c6f12bf339 Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp --- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Sat Oct 14 17:12:55 2023 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Wed Nov 08 08:55:12 2023 +0100 @@ -79,6 +79,10 @@ } } + void ResetGlobalContext() + { + globalContext_ = NULL; + } bool HasGlobalContext() { diff -r d63c58d650ff -r 93c6f12bf339 Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h --- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Sat Oct 14 17:12:55 2023 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Wed Nov 08 08:55:12 2023 +0100 @@ -137,6 +137,8 @@ void SetGlobalContext(OrthancPluginContext* context); + void ResetGlobalContext(); + bool HasGlobalContext(); OrthancPluginContext* GetGlobalContext(); diff -r d63c58d650ff -r 93c6f12bf339 Sources/Plugin.cpp --- a/Sources/Plugin.cpp Sat Oct 14 17:12:55 2023 +0200 +++ b/Sources/Plugin.cpp Wed Nov 08 08:55:12 2023 +0100 @@ -319,7 +319,8 @@ { if (!globalFunctions_.empty()) { - ORTHANC_PLUGINS_THROW_EXCEPTION(BadSequenceOfCalls); + return; +// ORTHANC_PLUGINS_THROW_EXCEPTION(BadSequenceOfCalls); } /** @@ -664,6 +665,8 @@ PythonLock::GlobalFinalize(); } + + OrthancPlugins::ResetGlobalContext(); } diff -r d63c58d650ff -r 93c6f12bf339 TODO --- a/TODO Sat Oct 14 17:12:55 2023 +0200 +++ b/TODO Wed Nov 08 08:55:12 2023 +0100 @@ -1,3 +1,16 @@ +Bug: +=== + +* The plugin does not support calls to 'curl http://localhost:8042/tools/reset -d ""' + if the script registers the OnChangeCallback. Ex: + + import orthanc + + def OnChange(changeType, level, resource): + print("OnChange") + orthanc.RegisterOnChangeCallback(OnChange) + + Primitives the Orthanc community is missing ===========================================