3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-19 12:23:38 +00:00

fix crash on Mac due to different destruction order of globals

the mutex in memory_manager has to be destroyed after all mem deallocations happen
This commit is contained in:
Nuno Lopes 2019-06-13 11:22:18 +01:00
parent 2bee9a062f
commit cf3e649462
12 changed files with 80 additions and 120 deletions

View file

@ -23,7 +23,7 @@ Revision History:
#include "util/string_buffer.h"
#include <cstring>
static mutex* s_mux = nullptr;
static mutex g_symbol_lock;
symbol symbol::m_dummy(TAG(void*, nullptr, 2));
const symbol symbol::null;
@ -38,7 +38,7 @@ public:
char const * get_str(char const * d) {
const char * result;
lock_guard lock(*s_mux);
lock_guard lock(g_symbol_lock);
str_hashtable::entry * e;
if (m_table.insert_if_not_there_core(d, e)) {
// new entry
@ -66,16 +66,11 @@ void initialize_symbols() {
if (!g_symbol_table) {
g_symbol_table = alloc(internal_symbol_table);
}
if (!s_mux) {
s_mux = alloc(mutex);
}
}
void finalize_symbols() {
dealloc(g_symbol_table);
dealloc(s_mux);
g_symbol_table = nullptr;
s_mux = nullptr;
}
symbol::symbol(char const * d) {