Skip to content

Commit f18d632

Browse files
authored
Prevent SIOF when linking with a Log4cxx static library (#604)
1 parent a433a1e commit f18d632

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/cpp/atexitregistry.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,22 @@ namespace
5151
private:
5252
std::recursive_mutex mutex;
5353
std::map<void*, std::function<void()>> actions;
54-
} s_instance;
54+
};
5555
}
5656

5757
AtExitRegistry& AtExitRegistry::instance()
5858
{
59-
return s_instance;
59+
static AtExitRegistryImpl impl;
60+
return impl;
6061
}
6162

6263
void AtExitRegistry::add(void* key, std::function<void()> action)
6364
{
64-
return s_instance.add(key, std::move(action));
65+
return static_cast<AtExitRegistryImpl&>(instance()).add(key, std::move(action));
6566
}
6667

6768
void AtExitRegistry::del(void* key)
6869
{
69-
return s_instance.del(key);
70+
return static_cast<AtExitRegistryImpl&>(instance()).del(key);
7071
}
7172

0 commit comments

Comments
 (0)