From a222b183fb912d604f6d77ab8915dc41d2463bd2 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@cnes.fr>
Date: Wed, 14 Mar 2018 08:52:43 +0100
Subject: [PATCH] DOC: Add warning about corner case of logger instance

---
 Modules/Core/Common/include/otbLogger.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Modules/Core/Common/include/otbLogger.h b/Modules/Core/Common/include/otbLogger.h
index d252a93d31..ef420c7b23 100644
--- a/Modules/Core/Common/include/otbLogger.h
+++ b/Modules/Core/Common/include/otbLogger.h
@@ -44,6 +44,14 @@ public:
 
   itkTypeMacro(Logger, itk::Logger);
 
+  /**
+   * If Logger crashes when called from the destructor of a static
+   * or global object, the singleton might have already been destroyed.
+   * You can prolong its lifetime by calling Logger::Instance()
+   * from that object's constructor.
+   *
+   * See https://stackoverflow.com/questions/335369/finding-c-static-initialization-order-problems#335746
+   */
   static Pointer Instance();
 
   itkNewMacro(Self);
-- 
GitLab