fix at-exit close handling for non-main place

This bug has been causing problems since the change to the `math`
library to register mpfr_free_cache() only once per place.
This commit is contained in:
Matthew Flatt 2015-03-13 12:21:06 -06:00
parent 4af6770ed4
commit eca0c18730

View File

@ -1846,15 +1846,17 @@ void scheme_add_atexit_closer(Scheme_Exit_Closer_Func f)
# define RUNNING_IN_ORIGINAL_PLACE 1 # define RUNNING_IN_ORIGINAL_PLACE 1
#endif #endif
if (!cust_closers && RUNNING_IN_ORIGINAL_PLACE) { if (!cust_closers) {
if (replacement_at_exit) { if (RUNNING_IN_ORIGINAL_PLACE) {
replacement_at_exit(do_run_atexit_closers_on_all); if (replacement_at_exit) {
} else { replacement_at_exit(do_run_atexit_closers_on_all);
} else {
#ifdef USE_ON_EXIT_FOR_ATEXIT #ifdef USE_ON_EXIT_FOR_ATEXIT
on_exit(do_run_atexit_closers_on_all, NULL); on_exit(do_run_atexit_closers_on_all, NULL);
#else #else
atexit(do_run_atexit_closers_on_all); atexit(do_run_atexit_closers_on_all);
#endif #endif
}
} }
REGISTER_SO(cust_closers); REGISTER_SO(cust_closers);