From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: <87y14j25mg.fsf@protonmail.com> References: <8b1c8e1f-e0b9-4049-888c-3f723e0008a9@gmail.com> <86zfp8wlrv.fsf@gnu.org> <87cym4cvyo.fsf@protonmail.com> <86wmkcwj9c.fsf@gnu.org> <867cc6nv7u.fsf@gnu.org> <87v7zq5jap.fsf@protonmail.com> <86v7zqmdo5.fsf@gnu.org> <86bk1gxz1z.fsf@mail.linkov.net> <86v7zojuqw.fsf@gnu.org> Reply-To: Pip Cet Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8709"; mail-complaints-to="usenet@ciao.gmane.io" Cc: execvy@gmail.com, 72692@debbugs.gnu.org, Juri Linkov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 26 07:53:35 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1siSfX-00027O-HV for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 26 Aug 2024 07:53:35 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1siSfC-0007PR-Me; Mon, 26 Aug 2024 01:53:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1siSfB-0007PJ-9N for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2024 01:53:13 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1siSfA-0003UT-Ud for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2024 01:53:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=esivKMgNPzTTH5BjdOdO/YuHvNE91JGlpVENeEjxjuM=; b=XqNpXmyegNEH3ezmYSvhsRlMiLnR4wsv63j3z6wj0oJ/3s5vJDiOKIG/a5J1L2zz9vYuv/M2B02bNm/8BL1BJf2M+Cf9KL+EO4ic+ov3NJJbS3jeuZka0sJwWZZl2NS60TkEZHIJwP24my7q74zFOq7umFj5eAD1x0lixtUJBS6QpZJZam8Q4htIxqR8yenB/F6l/MYrl3HIPE4sUERolQnsjSnEbmbL95GNwg1FkYN9Vj/VUQkecVVnGUYIfK7OPB0eYkVRuYLNLaYMwAjw7rPWfeWY3tQ7b0voDOQGO6OwtxI+fFxTqyfJVBt0GbElK9ZKC/MujGA7mHd0Ni6QSA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1siSfy-0000Uw-3Q for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2024 01:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Aug 2024 05:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72692 X-GNU-PR-Package: emacs Original-Received: via spool by 72692-submit@debbugs.gnu.org id=B72692.17246515981852 (code B ref 72692); Mon, 26 Aug 2024 05:54:02 +0000 Original-Received: (at 72692) by debbugs.gnu.org; 26 Aug 2024 05:53:18 +0000 Original-Received: from localhost ([127.0.0.1]:43556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1siSfF-0000Tn-Rc for submit@debbugs.gnu.org; Mon, 26 Aug 2024 01:53:18 -0400 Original-Received: from mail-4316.protonmail.ch ([185.70.43.16]:54263) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1siSfC-0000TW-8I for 72692@debbugs.gnu.org; Mon, 26 Aug 2024 01:53:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1724651536; x=1724910736; bh=esivKMgNPzTTH5BjdOdO/YuHvNE91JGlpVENeEjxjuM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Un2DsnJug4nA4N62SoLpr1i0Kt+ohGwvjNvlSaeJ9JRGmIEPLkvuyNz8xo3YiBzHw 6CsyzU61VtG+ikgpox7eD96+mpSBnSF+slWWMAIumR5OmPENytQO8/2wOsZopef2I3 1b3OvJlvr8LTiK6lS1Gh3a9QSAju1Zs9oOJwbmKoeBlANR3AIIO0o7TrOrh5nfZhUJ 8xGZqbLxRsBo4LTBXbSaBp3sR5j4XWsMystuXhnKlEm1gVrOYr3Kmx5ISSddeGdcEb pteQZrT+ESL+naJMz7k9kuPBuO3EJ/vzRu2uK/J9bSrfzXOKRJ/rQ25ZkVoHgnuFTa ji91kVgOR7r5g== In-Reply-To: <86v7zojuqw.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 1116893cb719993cdd5c2d273ff43f2e98449cd6 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290773 Archived-At: "Eli Zaretskii" writes: >> From: Juri Linkov >> Cc: Pip Cet , execvy@gmail.com, 72692@debbugs.g= nu.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 =3D 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 =3D=3D 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 =3D true; ASET (Vfontset_table, face->fontset, Qnil); if (face->fontset < next_fontset_id) next_fontset_id =3D 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 =3D false; - XFRAME (w->frame)->face_change =3D 0; free_all_realized_faces (Qnil); + XFRAME (w->frame)->face_change =3D 0; } else if (XFRAME (w->frame)->face_change) { - XFRAME (w->frame)->face_change =3D 0; free_all_realized_faces (w->frame); + XFRAME (w->frame)->face_change =3D 0; } } =20 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) } =20 =20 +static void uncache_face (struct face_cache *c, struct face *face); + /* Free realized face FACE, including its X resources. FACE may be null. */ =20 @@ -4596,9 +4598,28 @@ free_realized_face (struct frame *f, struct face *fa= ce) #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) =09{ -=09 /* Free fontset of FACE if it is ASCII face. */ -=09 if (face->fontset >=3D 0 && face =3D=3D face->ascii_face) -=09 free_face_fontset (f, face); +=09 if (face =3D=3D face->ascii_face) +=09 { +=09 struct face *next; +=09 /* Because cache_face puts non-ASCII faces last in the +=09=09 collision chain, we only have to check in one +=09=09 direction. */ +=09 for (struct face *face_nonascii =3D face->next; face_nonascii; +=09=09 face_nonascii =3D next) +=09=09{ +=09=09 next =3D face_nonascii->next; + +=09=09 if (face =3D=3D face_nonascii->ascii_face) +=09=09 { +=09=09 uncache_face (FRAME_FACE_CACHE (f), face_nonascii); +=09=09 free_realized_face (f, face_nonascii); +=09=09 } +=09=09} + +=09 /* Free fontset of FACE if it is ASCII face. */ +=09 if (face->fontset >=3D 0) +=09=09free_face_fontset (f, face); +=09 } =20 #ifdef HAVE_X_WINDOWS =09 /* This function might be called with the frame's display Pip