changeset 5195:32df369198ac

fix /tools/reset crashing when ExtraMainDicomTags were defined
author Alain Mazy <am@osimis.io>
date Tue, 28 Mar 2023 10:48:13 +0200
parents 0ea402b4d901
children f8f1c4a9a216
files NEWS OrthancFramework/Sources/DicomFormat/DicomMap.h OrthancServer/Sources/OrthancInitialization.cpp
diffstat 3 files changed, 5 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Sat Mar 25 12:27:21 2023 +0100
+++ b/NEWS	Tue Mar 28 10:48:13 2023 +0200
@@ -10,7 +10,7 @@
 ---------
 
 * Fix issue 214: VOILUTSequence is not returned in Wado-RS
-
+* Fix /tools/reset crashing when ExtraMainDicomTags were defined
 
 version 1.11.3 (2023-02-03)
 ===========================
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.h	Sat Mar 25 12:27:21 2023 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.h	Tue Mar 28 10:48:13 2023 +0200
@@ -31,10 +31,6 @@
 #include <map>
 #include <json/value.h>
 
-#if ORTHANC_BUILD_UNIT_TESTS == 1
-#  include <gtest/gtest_prod.h>
-#endif
-
 namespace Orthanc
 {
   class ORTHANC_PUBLIC DicomMap : public boost::noncopyable
@@ -48,10 +44,6 @@
     friend class FromDcmtkBridge;
     friend class ParsedDicomFile;
 
-#if ORTHANC_BUILD_UNIT_TESTS == 1
-    friend class DicomMapMainTagsTests;
-#endif
-
     Content content_;
 
     // Warning: This takes the ownership of "value"
@@ -59,12 +51,11 @@
                           uint16_t element, 
                           DicomValue* value);
 
-    // used for unit tests only
-    static void ResetDefaultMainDicomTags();
-
   public:
     ~DicomMap();
 
+    static void ResetDefaultMainDicomTags();
+
     size_t GetSize() const;
     
     DicomMap* Clone() const;
--- a/OrthancServer/Sources/OrthancInitialization.cpp	Sat Mar 25 12:27:21 2023 +0100
+++ b/OrthancServer/Sources/OrthancInitialization.cpp	Tue Mar 28 10:48:13 2023 +0200
@@ -204,6 +204,8 @@
   {
     static const char* const EXTRA_MAIN_DICOM_TAGS = "ExtraMainDicomTags";
     
+    DicomMap::ResetDefaultMainDicomTags();
+
     if (configuration.type() != Json::objectValue ||
         !configuration.isMember(EXTRA_MAIN_DICOM_TAGS) ||
         configuration[EXTRA_MAIN_DICOM_TAGS].type() != Json::objectValue)