Merge branch 'dev' into dev-slice

This commit is contained in:
Daan Leijen 2022-01-11 15:42:36 -08:00
commit df01e463b6

View File

@ -473,7 +473,9 @@ static void mi_process_load(void) {
MI_UNUSED(dummy);
#endif
os_preloading = false;
atexit(&mi_process_done);
#if !(defined(_WIN32) && defined(MI_SHARED_LIB)) // use Dll process detach (see below) instead of atexit (issue #521)
atexit(&mi_process_done);
#endif
_mi_options_init();
mi_process_init();
//mi_stats_reset();-
@ -585,9 +587,14 @@ static void mi_process_done(void) {
if (reason==DLL_PROCESS_ATTACH) {
mi_process_load();
}
else if (reason==DLL_THREAD_DETACH) {
if (!mi_is_redirected()) mi_thread_done();
else if (reason==DLL_PROCESS_DETACH) {
mi_process_done();
}
else if (reason==DLL_THREAD_DETACH) {
if (!mi_is_redirected()) {
mi_thread_done();
}
}
return TRUE;
}