mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 20:05:51 +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:
parent
2bee9a062f
commit
cf3e649462
12 changed files with 80 additions and 120 deletions
|
@ -26,7 +26,6 @@ rational rational::m_zero;
|
|||
rational rational::m_one;
|
||||
rational rational::m_minus_one;
|
||||
vector<rational> rational::m_powers_of_two;
|
||||
static mutex* s_mux = nullptr;
|
||||
|
||||
static void mk_power_up_to(vector<rational> & pws, unsigned n) {
|
||||
if (pws.empty()) {
|
||||
|
@ -41,10 +40,11 @@ static void mk_power_up_to(vector<rational> & pws, unsigned n) {
|
|||
}
|
||||
}
|
||||
|
||||
static mutex g_powers_of_two;
|
||||
|
||||
rational rational::power_of_two(unsigned k) {
|
||||
rational result;
|
||||
lock_guard lock(*s_mux);
|
||||
lock_guard lock(g_powers_of_two);
|
||||
{
|
||||
if (k >= m_powers_of_two.size())
|
||||
mk_power_up_to(m_powers_of_two, k+1);
|
||||
|
@ -64,7 +64,6 @@ void finalize_inf_int_rational();
|
|||
void rational::initialize() {
|
||||
if (!g_mpq_manager) {
|
||||
g_mpq_manager = alloc(synch_mpq_manager);
|
||||
s_mux = alloc(mutex);
|
||||
m().set(m_zero.m_val, 0);
|
||||
m().set(m_one.m_val, 1);
|
||||
m().set(m_minus_one.m_val, -1);
|
||||
|
@ -82,7 +81,5 @@ void rational::finalize() {
|
|||
m_minus_one.~rational();
|
||||
dealloc(g_mpq_manager);
|
||||
g_mpq_manager = nullptr;
|
||||
dealloc(s_mux);
|
||||
s_mux = nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue