From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#50571: 28.0.50; Redisplay segfaults with empty face cache Date: Sun, 19 Sep 2021 18:47:32 +0300 Message-ID: <83ee9k4lez.fsf@gnu.org> References: <87ilz4msha.fsf@tcd.ie> <831r5sea46.fsf@gnu.org> <87a6kggiz6.fsf@tcd.ie> <83bl4vcnsp.fsf@gnu.org> <83a6kfcmdk.fsf@gnu.org> <87y27zuek1.fsf@tcd.ie> <87v92wacsx.fsf@tcd.ie> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30823"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50571@debbugs.gnu.org To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 19 17:48:14 2021 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 1mRz36-0007pl-2f for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Sep 2021 17:48:12 +0200 Original-Received: from localhost ([::1]:50000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRz35-00086U-00 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Sep 2021 11:48:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRz2w-00086M-Jc for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 11:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRz2w-0003YY-BJ for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 11:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mRz2w-0001QP-6h for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 11:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Sep 2021 15:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50571 X-GNU-PR-Package: emacs Original-Received: via spool by 50571-submit@debbugs.gnu.org id=B50571.16320664735462 (code B ref 50571); Sun, 19 Sep 2021 15:48:02 +0000 Original-Received: (at 50571) by debbugs.gnu.org; 19 Sep 2021 15:47:53 +0000 Original-Received: from localhost ([127.0.0.1]:39613 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRz2m-0001Q2-MD for submit@debbugs.gnu.org; Sun, 19 Sep 2021 11:47:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRz2k-0001Po-Dl for 50571@debbugs.gnu.org; Sun, 19 Sep 2021 11:47:52 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:56066) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRz2d-0003He-GR; Sun, 19 Sep 2021 11:47:44 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1159 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRz2d-0007TU-4V; Sun, 19 Sep 2021 11:47:43 -0400 In-Reply-To: <87v92wacsx.fsf@tcd.ie> (contovob@tcd.ie) 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" Xref: news.gmane.io gmane.emacs.bugs:214734 Archived-At: > From: "Basil L. Contovounesios" > Cc: 50571@debbugs.gnu.org > Date: Sun, 19 Sep 2021 14:57:02 +0100 > > Unfortunately I found another hole that needs plugging, but fortunately > I can reliably reproduce it with the following site-specific steps: > > 0. emacs > 1. C-x p p (project-switch-project) > 2. Select a checkout of https://github.com/abo-abo/swiper, > using Ivy completion. > 3. f (project-find-file) > 4. ivy.el RET > 5. C-s (isearch-forward) > 6. C-g > 7. M-s s (counsel-grep-or-swiper) > 8. #[[:digit:]] > > This brings a bug-reference-bug-regexp match onto screen, which again > triggers a frame creation via bug-reference's call to display-warning. > > The attached GDB log shows where the relevant frame's face cache is > cleared right before the crash (search for 'New value = 0'), at which > point f->inhibit_clear_image_cache is false. Thanks for the data. I guess this is a preview of how allowing arbitrary Lisp that affects the display in fontification-functions will keep shooting in the foot, time and again. Please try the patch below. diff --git a/src/xdisp.c b/src/xdisp.c index 2e72f6b..8b56fee 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4288,12 +4288,17 @@ handle_fontified_prop (struct it *it) struct buffer *obuf = current_buffer; ptrdiff_t begv = BEGV, zv = ZV; bool old_clip_changed = current_buffer->clip_changed; + bool saved_inhibit_flag = it->f->inhibit_clear_image_cache; val = Vfontification_functions; specbind (Qfontification_functions, Qnil); eassert (it->end_charpos == ZV); + /* Don't allow Lisp that runs from 'fontification-functions' + clear our face and image caches behind our backs. */ + it->f->inhibit_clear_image_cache = true; + if (!CONSP (val) || EQ (XCAR (val), Qlambda)) safe_call1 (val, pos); else @@ -4327,6 +4332,7 @@ handle_fontified_prop (struct it *it) } } + it->f->inhibit_clear_image_cache = saved_inhibit_flag; unbind_to (count, Qnil); /* Fontification functions routinely call `save-restriction'.