[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 4819616: Avoid crashes at startup on systems that
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-25 4819616: Avoid crashes at startup on systems that CANNOT_DUMP |
Date: |
Sat, 12 Mar 2016 09:53:07 +0000 |
branch: emacs-25
commit 48196164aa206d057874119cac2025d376566365
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Avoid crashes at startup on systems that CANNOT_DUMP
* src/xdisp.c (syms_of_xdisp) <redisplay--inhibit-bidi>: New
boolean variable.
(init_iterator, reseat_to_string)
(Fcurrent_bidi_paragraph_direction)
(Fbidi_find_overridden_directionality): Use
redisplay--inhibit-bidi instead of purify-flag, to determine when
it's safe to reorder bidirectional text.
* lisp/loadup.el (redisplay--inhibit-bidi): Set to t at the
beginning of the file. Reset to nil when charprop.el is
successfully loaded, or when we are going to dump, whichever
happens last. (Bug#22975)
---
lisp/loadup.el | 13 ++++++++++++-
src/xdisp.c | 16 +++++++++++-----
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/lisp/loadup.el b/lisp/loadup.el
index b620e65..bd47bed 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -47,6 +47,13 @@
;;; Code:
+;; This is used in xdisp.c to determine when bidi reordering is safe.
+;; (It starts non-nil in temacs, but we set it non-nil here anyway, in
+;; case someone loads loadup one more time.) We reset it after
+;; successfully loading charprop.el, which defines the Unicode tables
+;; bidi.c needs for its job.
+(setq redisplay--inhibit-bidi t)
+
;; Add subdirectories to the load-path for files that might get
;; autoloaded when bootstrapping.
;; This is because PATH_DUMPLOADSEARCH is just "../lisp".
@@ -162,7 +169,8 @@
(load "case-table")
;; This file doesn't exist when building a development version of Emacs
;; from the repository. It is generated just after temacs is built.
-(load "international/charprop.el" t)
+(if (load "international/charprop.el" t)
+ (setq redisplay--inhibit-bidi nil))
(load "international/characters")
(load "composite")
@@ -415,6 +423,9 @@ lost after dumping")))
(if (null (garbage-collect))
(setq pure-space-overflow t))
+;; Make sure we will attempt bidi reordering henceforth.
+(setq redisplay--inhibit-bidi nil)
+
(if (member (car (last command-line-args)) '("dump" "bootstrap"))
(progn
(message "Dumping under the name emacs")
diff --git a/src/xdisp.c b/src/xdisp.c
index e5ac650..ce992d4 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2946,7 +2946,7 @@ init_iterator (struct it *it, struct window *w,
character properties needed for reordering are not yet
available. */
it->bidi_p =
- NILP (Vpurify_flag)
+ !redisplay__inhibit_bidi
&& !NILP (BVAR (current_buffer, bidi_display_reordering))
&& it->multibyte_p;
@@ -6641,7 +6641,7 @@ reseat_to_string (struct it *it, const char *s,
Lisp_Object string,
loading loadup.el, as the necessary character property tables are
not yet available. */
it->bidi_p =
- NILP (Vpurify_flag)
+ !redisplay__inhibit_bidi
&& !NILP (BVAR (&buffer_defaults, bidi_display_reordering));
if (s == NULL)
@@ -21230,7 +21230,7 @@ See also `bidi-paragraph-direction'. */)
|| NILP (BVAR (buf, enable_multibyte_characters))
/* When we are loading loadup.el, the character property tables
needed for bidi iteration are not yet available. */
- || !NILP (Vpurify_flag))
+ || redisplay__inhibit_bidi)
return Qleft_to_right;
else if (!NILP (BVAR (buf, bidi_paragraph_direction)))
return BVAR (buf, bidi_paragraph_direction);
@@ -21354,7 +21354,7 @@ the `bidi-class' property of a character. */)
/* When we are loading loadup.el, the character property
tables needed for bidi iteration are not yet
available. */
- || !NILP (Vpurify_flag))
+ || redisplay__inhibit_bidi)
return Qnil;
validate_subarray (object, from, to, SCHARS (object), &from_pos,
&to_pos);
@@ -21382,7 +21382,7 @@ the `bidi-class' property of a character. */)
/* When we are loading loadup.el, the character property
tables needed for bidi iteration are not yet
available. */
- || !NILP (Vpurify_flag))
+ || redisplay__inhibit_bidi)
return Qnil;
set_buffer_temp (buf);
@@ -31806,6 +31806,12 @@ display table takes effect; in this case, Emacs does
not consult
DEFVAR_LISP ("redisplay--variables", Vredisplay__variables,
doc: /* A hash-table of variables changing which triggers a thorough
redisplay. */);
Vredisplay__variables = Qnil;
+
+ DEFVAR_BOOL ("redisplay--inhibit-bidi", redisplay__inhibit_bidi,
+ doc: /* Non-nil means it is not safe to attempt bidi reordering for
display. */);
+ /* Initialize to t, since we need to disable reordering until
+ loadup.el successfully loads charprop.el. */
+ redisplay__inhibit_bidi = true;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 4819616: Avoid crashes at startup on systems that CANNOT_DUMP,
Eli Zaretskii <=