This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


The following commit(s) were added to refs/heads/master by this push:
     new f18d632c Prevent SIOF when linking with a Log4cxx static library (#604)
f18d632c is described below

commit f18d632cc9f68e2a243e4b786e43e34189ea01cf
Author: Stephen Webb <[email protected]>
AuthorDate: Wed Mar 11 12:11:52 2026 +1100

    Prevent SIOF when linking with a Log4cxx static library (#604)
---
 src/main/cpp/atexitregistry.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/main/cpp/atexitregistry.cpp b/src/main/cpp/atexitregistry.cpp
index 2d5ad66b..8284dc09 100644
--- a/src/main/cpp/atexitregistry.cpp
+++ b/src/main/cpp/atexitregistry.cpp
@@ -51,21 +51,22 @@ namespace
        private:
                std::recursive_mutex mutex;
                std::map<void*, std::function<void()>> actions;
-       } s_instance;
+       };
 }
 
 AtExitRegistry& AtExitRegistry::instance()
 {
-       return s_instance;
+       static AtExitRegistryImpl impl;
+       return impl;
 }
 
 void AtExitRegistry::add(void* key, std::function<void()> action)
 {
-       return s_instance.add(key, std::move(action));
+       return static_cast<AtExitRegistryImpl&>(instance()).add(key, 
std::move(action));
 }
 
 void AtExitRegistry::del(void* key)
 {
-       return s_instance.del(key);
+       return static_cast<AtExitRegistryImpl&>(instance()).del(key);
 }
 

Reply via email to