summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/lazy_instance.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index 33eefe8..0849503 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -64,7 +64,8 @@ class LazyInstanceHelper {
};
explicit LazyInstanceHelper(LinkerInitialized x) { /* state_ is 0 */ }
- ~LazyInstanceHelper() { }
+ // Declaring a destructor (even if it's empty) will cause MSVC to register a
+ // static initializer to register the empty destructor with atexit().
// Make sure that instance is created, creating or waiting for it to be
// created if neccessary. Constructs with |ctor| in the space provided by
@@ -81,7 +82,8 @@ template <typename Type, typename Traits = DefaultLazyInstanceTraits<Type> >
class LazyInstance : public LazyInstanceHelper {
public:
explicit LazyInstance(LinkerInitialized x) : LazyInstanceHelper(x) { }
- ~LazyInstance() { }
+ // Declaring a destructor (even if it's empty) will cause MSVC to register a
+ // static initializer to register the empty destructor with atexit().
Type& Get() {
return *Pointer();