unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: emacs-28 c05864dd25: Avoid another segfault in 'face_at_buffer_position'
       [not found] ` <20220114141224.2E316C0DA30@vcs2.savannah.gnu.org>
@ 2022-01-14 15:01   ` Robert Pluim
  2022-01-14 15:13     ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Pluim @ 2022-01-14 15:01 UTC (permalink / raw)
  To: emacs-devel; +Cc: Eli Zaretskii

>>>>> 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
-- 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: emacs-28 c05864dd25: Avoid another segfault in 'face_at_buffer_position'
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2022-01-14 15:13 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

> 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-14 15:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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

Code repositories for project(s) associated with this 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).