diff --git a/main/gbx/gbx_c_process.c b/main/gbx/gbx_c_process.c index 99c3d3966..81160a1ce 100644 --- a/main/gbx/gbx_c_process.c +++ b/main/gbx/gbx_c_process.c @@ -628,15 +628,16 @@ static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env) goto __ABORT_ERRNO; } - // Adding to the running process list - - add_process_to_running_list(process); - OBJECT_REF(process); - // Start the SIGCHLD callback init_child(); + // Adding to the running process list after, because init_child() checks the signal handlers, + // and may call callback_child(). + + add_process_to_running_list(process); + OBJECT_REF(process); + // Block SIGCHLD and fork sigemptyset(&sig); diff --git a/main/gbx/gbx_class.c b/main/gbx/gbx_class.c index 09ae54830..1c5a95cd1 100644 --- a/main/gbx/gbx_class.c +++ b/main/gbx/gbx_class.c @@ -262,7 +262,7 @@ CLASS *class_replace_global(CLASS *class) if (!CLASS_is_loaded(class)) return class; - + if (class->count == 0) return class_keep_global(class); diff --git a/main/gbx/gbx_exec_loop.c b/main/gbx/gbx_exec_loop.c index e6780e6ed..4682ecd66 100644 --- a/main/gbx/gbx_exec_loop.c +++ b/main/gbx/gbx_exec_loop.c @@ -2443,12 +2443,6 @@ _BYREF: /*-----------------------------------------------*/ _SUBR_COMPN: - - SYNC_PC(); - SYNC_SP(); - _SUBR_compe(code); - goto _NEXT; - _SUBR_COMPE: SYNC_PC();