3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 19: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:
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

@ -7,7 +7,6 @@ Copyright (c) 2015 Microsoft Corporation
#include<fstream>
#include<signal.h>
#include<time.h>
#include<mutex>
#include "util/gparams.h"
#include "util/timeout.h"
#include "util/cancel_eh.h"
@ -22,11 +21,11 @@ Copyright (c) 2015 Microsoft Corporation
#include "opt/opt_parse.h"
extern bool g_display_statistics;
extern std::mutex* g_stat_mux;
static bool g_first_interrupt = true;
static opt::context* g_opt = nullptr;
static double g_start_time = 0;
static unsigned_vector g_handles;
static std::mutex display_stats_mux;
@ -71,7 +70,7 @@ static void STD_CALL on_ctrl_c(int) {
else {
signal (SIGINT, SIG_DFL);
{
std::lock_guard<std::mutex> lock(*g_stat_mux);
std::lock_guard<std::mutex> lock(display_stats_mux);
display_statistics();
}
raise(SIGINT);
@ -80,7 +79,7 @@ static void STD_CALL on_ctrl_c(int) {
static void on_timeout() {
{
std::lock_guard<std::mutex> lock(*g_stat_mux);
std::lock_guard<std::mutex> lock(display_stats_mux);
display_statistics();
}
exit(0);
@ -134,7 +133,7 @@ static unsigned parse_opt(std::istream& in, opt_format f) {
std::cerr << ex.msg() << "\n";
}
{
std::lock_guard<std::mutex> lock(*g_stat_mux);
std::lock_guard<std::mutex> lock(display_stats_mux);
display_statistics();
register_on_timeout_proc(nullptr);
g_opt = nullptr;