core(logger): avoid destruction of GlobalLoggingInitStruct object
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Tue, 6 Oct 2020 12:50:32 +0000 (12:50 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Tue, 6 Oct 2020 12:50:32 +0000 (12:50 +0000)
- keep logger available until the program termination

modules/core/src/logger.cpp
platforms/scripts/valgrind.supp

index 7dd6f938170e52f54f612bfb6a8d4706fbef3ba2..dbb25f9e09ef515341dbae0522874d4035779463 100644 (file)
@@ -94,8 +94,7 @@ LogLevel GlobalLoggingInitStruct::m_defaultUnconfiguredGlobalLevel = GlobalLoggi
 //
 static GlobalLoggingInitStruct& getGlobalLoggingInitStruct()
 {
-    static GlobalLoggingInitStruct globalLoggingInitInstance;
-    return globalLoggingInitInstance;
+    CV_SINGLETON_LAZY_INIT_REF(GlobalLoggingInitStruct, new GlobalLoggingInitStruct());
 }
 
 // To ensure that the combined struct defined above is initialized even
index 1fa1fff688f7fc9bcad6e8001aa0b4e6c21d3786..10ea856e9d98bd74c0100e0bdb4dc3db3ed6e4c2 100644 (file)
    fun:__itt_*create*
 }
 
+{
+   OpenCV-SingletonLogger
+   Memcheck:Leak
+   ...
+   fun:_ZN2cv5utils7logging8internalL26getGlobalLoggingInitStructEv
+}
+
 {
    OpenCV-gtk_init
    Memcheck:Leak