unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Robert Pluim <rpluim@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: emacs-28 c05864dd25: Avoid another segfault in 'face_at_buffer_position'
Date: Fri, 14 Jan 2022 17:13:47 +0200	[thread overview]
Message-ID: <83lezi1has.fsf@gnu.org> (raw)
In-Reply-To: <87v8ymqs35.fsf@gmail.com> (message from Robert Pluim on Fri, 14 Jan 2022 16:01:34 +0100)

> From: Robert Pluim <rpluim@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>
> Date: Fri, 14 Jan 2022 16:01:34 +0100
> 
>     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?

I want the "usual" case, where default_face is non-NULL, to work as
quickly as possible.  The face cache being cleared is a relatively
rare exception.



      reply	other threads:[~2022-01-14 15:13 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   ` emacs-28 c05864dd25: Avoid another segfault in 'face_at_buffer_position' Robert Pluim
2022-01-14 15:13     ` Eli Zaretskii [this message]

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=83lezi1has.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rpluim@gmail.com \
    /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).