From: Eli Zaretskii Date: Fri, 19 Aug 2011 11:30:29 +0000 (+0300) Subject: Avoid a crash in mouse-highlight of Speedbar frames. X-Git-Tag: emacs-pretest-24.0.90~104^2~124^2~4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=823564e519dd1f3e81a79949e1abc033c9e7c0a5;p=emacs.git Avoid a crash in mouse-highlight of Speedbar frames. src/xfaces.c (face_at_buffer_position): Avoid repeated evaluation of face ID by FACE_FROM_ID, and avoid a crash when mouse is moved from an Org mode buffer to a Speedbar frame. --- diff --git a/src/ChangeLog b/src/ChangeLog index b5474fcc55b..85a55b2b7c9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-08-19 Eli Zaretskii + * xfaces.c (face_at_buffer_position): Avoid repeated evaluation of + face ID by FACE_FROM_ID, and avoid a crash when mouse is moved + from an Org mode buffer to a Speedbar frame. + * xdisp.c (RECORD_MAX_MIN_POS): If the display element comes from a composition, take its buffer position from IT->cmp_it.charpos. Fixes cursor positioning at the beginning of a line that begins diff --git a/src/xfaces.c b/src/xfaces.c index 83c92cdbc52..52b86638a50 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -6008,9 +6008,18 @@ face_at_buffer_position (struct window *w, EMACS_INT pos, *endptr = endpos; - default_face = FACE_FROM_ID (f, base_face_id >= 0 ? base_face_id - : NILP (Vface_remapping_alist) ? DEFAULT_FACE_ID - : lookup_basic_face (f, DEFAULT_FACE_ID)); + { + int face_id; + + if (base_face_id >= 0) + face_id = base_face_id; + else if (NILP (Vface_remapping_alist)) + face_id = DEFAULT_FACE_ID; + else + face_id = lookup_basic_face (f, DEFAULT_FACE_ID); + + default_face = FACE_FROM_ID (f, face_id); + } /* Optimize common cases where we can use the default face. */ if (noverlays == 0