unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: emacs-devel@gnu.org
Cc: Eli Zaretskii <eliz@gnu.org>
Subject: Re: emacs-28 c05864dd25: Avoid another segfault in 'face_at_buffer_position'
Date: Fri, 14 Jan 2022 16:01:34 +0100	[thread overview]
Message-ID: <87v8ymqs35.fsf@gmail.com> (raw)
In-Reply-To: <20220114141224.2E316C0DA30@vcs2.savannah.gnu.org> (Eli Zaretskii's message of "Fri, 14 Jan 2022 09:12:24 -0500 (EST)")

>>>>> On Fri, 14 Jan 2022 09:12:24 -0500 (EST), Eli Zaretskii <eliz@gnu.org> said:

    Eli> branch: emacs-28
    Eli> commit c05864dd25c820fe250672d32d6ec77ba946670d
    Eli> Author: Eli Zaretskii <eliz@gnu.org>
    Eli> Commit: Eli Zaretskii <eliz@gnu.org>

    Eli>     Avoid another segfault in 'face_at_buffer_position'
    
    Eli>     * src/xfaces.c (face_at_buffer_position): Make really sure the
    Eli>     default face is usable.  (Bug#53254)
    Eli> ---
    Eli>  src/xfaces.c | 8 ++++++--
    Eli>  1 file changed, 6 insertions(+), 2 deletions(-)

    Eli> diff --git a/src/xfaces.c b/src/xfaces.c
    Eli> index b9fb7c0ac1..dff5ae346d 100644
    Eli> --- a/src/xfaces.c
    Eli> +++ b/src/xfaces.c
    Eli> @@ -6425,8 +6425,12 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
 
    Eli>      default_face = FACE_FROM_ID_OR_NULL (f, face_id);
    Eli>      if (!default_face)
    Eli> -      default_face = FACE_FROM_ID (f,
    Eli> -				   lookup_basic_face (w, f, DEFAULT_FACE_ID));
    Eli> +      {
    Eli> +	if (FRAME_FACE_CACHE (f)->used == 0)
    Eli> +	  recompute_basic_faces (f);
    Eli> +	default_face = FACE_FROM_ID (f,
    Eli> +				     lookup_basic_face (w, f, DEFAULT_FACE_ID));
    Eli> +      }
    Eli>    }

If youʼre going to need to check the face cache, how about doing that
unconditionally? ie removing FACE_FROM_ID_OR_NULL and the
!default_face bit?

Robert
-- 



       reply	other threads:[~2022-01-14 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <164216954392.28421.12737811589765002298@vcs2.savannah.gnu.org>
     [not found] ` <20220114141224.2E316C0DA30@vcs2.savannah.gnu.org>
2022-01-14 15:01   ` Robert Pluim [this message]
2022-01-14 15:13     ` emacs-28 c05864dd25: Avoid another segfault in 'face_at_buffer_position' Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8ymqs35.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).