This is an automated email from the ASF dual-hosted git repository. swebb2066 pushed a commit to branch prevent_atexit_registry_siof in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit a081c46cee93c7da4e0d7a4feb33fde5d20685ea Author: Stephen Webb <[email protected]> AuthorDate: Tue Mar 10 16:28:41 2026 +1100 Prevent SIOF when linking with a Log4cxx static library --- 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); }
