From: Eli Zaretskii Date: Sat, 15 May 2021 17:44:40 +0000 (+0300) Subject: Fix segfaults when byte-compiling with native-compilation X-Git-Tag: emacs-28.0.90~2461 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b5e6dba05fcb4fa1c716dc759f8c4b2561bacaa7;p=emacs.git Fix segfaults when byte-compiling with native-compilation * src/emacs.c (main): Call 'set_initial_minibuffer_mode' before entering recursive-exit. * src/minibuf.c (init_minibuf_once_for_pdumper): Don't call 'set_minibuffer_mode' here... (set_initial_minibuffer_mode): ... set it in this new function. (Bug#48446) * src/lisp.h: Add prototype for 'set_initial_minibuffer_mode'. --- diff --git a/src/emacs.c b/src/emacs.c index 9157cd84a99..60a57a693ce 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2294,6 +2294,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem Vdump_mode = build_string (dump_mode); /* Enter editor command loop. This never returns. */ + set_initial_minibuffer_mode (); Frecursive_edit (); eassume (false); } diff --git a/src/lisp.h b/src/lisp.h index f83c55f827d..91b7a89d0f5 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4377,6 +4377,7 @@ extern EMACS_INT this_minibuffer_depth (Lisp_Object); extern EMACS_INT minibuf_level; extern Lisp_Object get_minibuffer (EMACS_INT); extern void init_minibuf_once (void); +extern void set_initial_minibuffer_mode (void); extern void syms_of_minibuf (void); extern void barf_if_interaction_inhibited (void); diff --git a/src/minibuf.c b/src/minibuf.c index b40d1fbafc8..cffb7fe787c 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2271,6 +2271,13 @@ If no minibuffer is active, return nil. */) +void +set_initial_minibuffer_mode (void) +{ + Lisp_Object minibuf = get_minibuffer (0); + set_minibuffer_mode (minibuf, 0); +} + static void init_minibuf_once_for_pdumper (void); void @@ -2279,6 +2286,8 @@ init_minibuf_once (void) staticpro (&Vminibuffer_list); staticpro (&Vcommand_loop_level_list); pdumper_do_now_and_after_load (init_minibuf_once_for_pdumper); + /* Ensure our inactive minibuffer exists. */ + get_minibuffer (0); } static void @@ -2296,9 +2305,6 @@ init_minibuf_once_for_pdumper (void) minibuf_prompt = Qnil; minibuf_save_list = Qnil; last_minibuf_string = Qnil; - /* Ensure our inactive minibuffer exists. */ - Lisp_Object minibuf = get_minibuffer (0); - set_minibuffer_mode (minibuf, 0); } void