unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: execvy@gmail.com, 72692@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
Subject: bug#72692: Emacs 31.05 (40eecd594ac) get SIGSEGV on Linux (Linux 6.6.45 Kde Wayland)
Date: Mon, 26 Aug 2024 05:52:11 +0000	[thread overview]
Message-ID: <87y14j25mg.fsf@protonmail.com> (raw)
In-Reply-To: <86v7zojuqw.fsf@gnu.org>

"Eli Zaretskii" <eliz@gnu.org> writes:

>> From: Juri Linkov <juri@linkov.net>
>> Cc: Pip Cet <pipcet@protonmail.com>,  execvy@gmail.com,  72692@debbugs.gnu.org
>> Date: Sun, 25 Aug 2024 20:58:40 +0300
>>
>> Unfortunately, after the release branch was merged to master now,
>> it's impossible to use Emacs with this change because point motion
>> is too jumpy and not as smooth as it was before.
>> Reverting this line fixes the problem:
>>
>> -      f->face_change = true;
>
> Sorry about that.  I've now reverted that change; we will have to find
> a cheaper solution for the original problem.

This patch, moving down the setting of f->face_change to when we
definitely know it's required, seems to avoid the
always-in-the-foreground problem, but I'm not sure it fixes Juri's
performance issue:

diff --git a/src/fontset.c b/src/fontset.c
index 16d14669c89..0fe65e9b481 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -920,6 +920,10 @@ free_face_fontset (struct frame *f, struct face *face)
     return;
   eassert (! BASE_FONTSET_P (fontset));
   eassert (f == XFRAME (FONTSET_FRAME (fontset)));
+  /* Force complete face recalculation next time we use the display
+     code, because there might be non-ASCII faces sharing this
+     fontset.  */
+  f->face_change = true;
   ASET (Vfontset_table, face->fontset, Qnil);
   if (face->fontset < next_fontset_id)
     next_fontset_id = face->fontset;
diff --git a/src/xdisp.c b/src/xdisp.c
index f9a10267bad..977495c2802 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3227,13 +3227,13 @@ init_iterator (struct it *it, struct window *w,
       if (face_change)
        {
          face_change = false;
-         XFRAME (w->frame)->face_change = 0;
          free_all_realized_faces (Qnil);
+         XFRAME (w->frame)->face_change = 0;
        }
       else if (XFRAME (w->frame)->face_change)
        {
-         XFRAME (w->frame)->face_change = 0;
          free_all_realized_faces (w->frame);
+         XFRAME (w->frame)->face_change = 0;
        }
     }
 

However, I would still prefer a solution which doesn't, even for a short
period of time, leave the non-ASCII faces' ->ascii_face pointing to a
face which has been freed, and their ->fontset identifying a fontset
which might be nil.

Is it true that all non-ASCII faces share their ASCII face's hash and
thus live in the same collision chain?  We could walk that and unrealize
them all when the ASCII face is unrealized, then.

Something like this:

diff --git a/src/xfaces.c b/src/xfaces.c
index 684b6ccfac7..bfc6b76d58a 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4585,6 +4585,8 @@ make_realized_face (Lisp_Object *attr)
 }
 
 
+static void uncache_face (struct face_cache *c, struct face *face);
+
 /* Free realized face FACE, including its X resources.  FACE may
    be null.  */
 
@@ -4596,9 +4598,28 @@ free_realized_face (struct frame *f, struct face *face)
 #ifdef HAVE_WINDOW_SYSTEM
       if (FRAME_WINDOW_P (f))
 	{
-	  /* Free fontset of FACE if it is ASCII face.  */
-	  if (face->fontset >= 0 && face == face->ascii_face)
-	    free_face_fontset (f, face);
+	  if (face == face->ascii_face)
+	    {
+	      struct face *next;
+	      /* Because cache_face puts non-ASCII faces last in the
+		 collision chain, we only have to check in one
+		 direction.  */
+	      for (struct face *face_nonascii = face->next; face_nonascii;
+		   face_nonascii = next)
+		{
+		  next = face_nonascii->next;
+
+		  if (face == face_nonascii->ascii_face)
+		    {
+		      uncache_face (FRAME_FACE_CACHE (f), face_nonascii);
+		      free_realized_face (f, face_nonascii);
+		    }
+		}
+
+	      /* Free fontset of FACE if it is ASCII face.  */
+	      if (face->fontset >= 0)
+		free_face_fontset (f, face);
+	    }
 
 #ifdef HAVE_X_WINDOWS
 	  /* This function might be called with the frame's display



Pip






  reply	other threads:[~2024-08-26  5:52 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-18  8:29 bug#72692: Emacs 31.05 (40eecd594ac) get SIGSEGV on Linux (Linux 6.6.45 Kde Wayland) Eval EXEC
2024-08-18  8:58 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18  9:08   ` Eval EXEC
2024-08-18  9:23     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18  9:24       ` execvy
2024-08-18  9:34         ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18  9:36           ` execvy
2024-08-18 12:43             ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18 12:53               ` execvy
2024-08-18 13:35               ` Eli Zaretskii
2024-08-18 13:44                 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18 14:12                   ` Eli Zaretskii
2024-08-18 14:59                     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18 15:38                       ` Eli Zaretskii
2024-08-18 16:08                         ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18 17:55                           ` Eli Zaretskii
2024-08-18 18:11                             ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18 18:52                               ` Eli Zaretskii
2024-08-19  6:17                                 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18 17:56                           ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-18 18:38                             ` Eli Zaretskii
2024-08-19  6:28                               ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-19 11:30                                 ` Eli Zaretskii
2024-08-19 13:32                                   ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-19 14:35                                     ` Eli Zaretskii
2024-08-19 15:03                                       ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-19 15:54                                         ` Eli Zaretskii
2024-08-19 16:34                                           ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-19 16:49                                             ` Eli Zaretskii
2024-08-24  9:09                                               ` Eli Zaretskii
2024-08-24 10:04                                                 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-24 10:13                                                   ` Eli Zaretskii
2024-08-25 17:58                                                     ` Juri Linkov
2024-08-25 18:49                                                       ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-27 16:31                                                         ` Juri Linkov
2024-08-28 11:50                                                           ` Eli Zaretskii
2024-08-28 16:21                                                             ` Juri Linkov
2024-08-28 17:53                                                               ` Eli Zaretskii
2024-08-28 18:35                                                                 ` Juri Linkov
2024-08-28 18:57                                                                   ` Eli Zaretskii
2024-08-28 19:02                                                                     ` Juri Linkov
2024-08-29  4:36                                                                       ` Eli Zaretskii
2024-08-29 10:06                                                                       ` Eli Zaretskii
2024-08-29 12:06                                                                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-29 12:26                                                                           ` Eli Zaretskii
2024-09-07  7:52                                                                             ` Eli Zaretskii
2024-09-08  0:42                                                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-28 17:56                                                               ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-25 18:57                                                       ` Eli Zaretskii
2024-08-26  5:52                                                         ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-08-26 12:39                                                           ` Eli Zaretskii
2024-08-26 19:04                                                             ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-26 19:20                                                               ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-27 11:47                                                                 ` Eli Zaretskii
2024-08-27 19:26                                                                   ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-28 11:48                                                                     ` Eli Zaretskii
2024-08-28 11:58                                                                       ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-27 11:44                                                               ` Eli Zaretskii
2024-08-27 19:23                                                                 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-28 11:41                                                                   ` Eli Zaretskii
2024-08-28 12:07                                                                     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-28 12:51                                                                       ` Eli Zaretskii
2024-08-18 19:24                       ` Eli Zaretskii
2024-08-19  6:07                         ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-19 14:17                           ` Eli Zaretskii
2024-08-19 14:44                             ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=87y14j25mg.fsf@protonmail.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=72692@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=execvy@gmail.com \
    --cc=juri@linkov.net \
    --cc=pipcet@protonmail.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).