diff --git a/src/w32_regex_traits.cpp b/src/w32_regex_traits.cpp index a2a4ffea..e43b0437 100644 --- a/src/w32_regex_traits.cpp +++ b/src/w32_regex_traits.cpp @@ -503,7 +503,7 @@ w32_regex_traits::~w32_regex_traits() #endif // add reference to static member here to ensure // that the linker includes it in the .exe: - if((--entry_count == 0) && (0 != &w32_regex_traits::i)) + if((--entry_count == 0) && (0 != &w32_regex_traits::i) && is_init) do_free(); #ifdef BOOST_HAS_THREADS g.acquire(false); @@ -672,7 +672,7 @@ w32_regex_traits::~w32_regex_traits() #endif // add reference to static member here to ensure // that the linker includes it in the .exe: - if((--entry_count == 0) && (0 != &w32_regex_traits::init_)) + if((--entry_count == 0) && (0 != &w32_regex_traits::init_) && is_init) do_free(); #ifdef BOOST_HAS_THREADS g.acquire(false);