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.devel Subject: Re: emacs-29 0e39ad6fa5: Fix crash after X error Date: Sat, 24 Dec 2022 10:30:41 +0200 Message-ID: <83fsd55hla.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7231"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 24 09:42:10 2022 Return-path: Envelope-to: ged-emacs-devel@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 1p906c-0001jS-Av for ged-emacs-devel@m.gmane-mx.org; Sat, 24 Dec 2022 09:42:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8zvl-00054k-5W; Sat, 24 Dec 2022 03:30:58 -0500 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 1p8zve-00052u-F0 for emacs-devel@gnu.org; Sat, 24 Dec 2022 03:30:51 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8zvc-0008Nw-D0; Sat, 24 Dec 2022 03:30:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Subject:To:From:Date:mime-version:in-reply-to: references; bh=svsN/ufYtEa4Vz0hxbLmrzvpZCA/dRCADQV+vNnPoTQ=; b=NbwDJyzjpLTUlG 8tRezOhob9n1UTKsSQ7zg4/R2+ck0EbpCuOkkyTdNy3qbndvFCenJKWRndf027CVGPY2RsUBN+jDi PPjGyWVYR2bUtKR7YUYQQT5gyMBf1c72QgA3epl1rZ61UGM28kbrtAkxftOLKyWyTRqSrRQzlXHQt vngczRUufWU1hLDQ3WIWRFMDF4tF9QVBT7wVDKF9al5xb5y3iyUXJGhgpqdwxEMCk37rOnkj/bMqG o7t4BqOJvAkh6Q9l6U1CWqAf64vLQgi+BxgeSqKL32QfU/AmcRr+3ShsQXzJuRacHDoHBuOzafOqa WK0/QpT6KvtVzwtA3mZA==; Original-Received: from [87.69.77.57] (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 1p8zvY-0001Bz-IX; Sat, 24 Dec 2022 03:30:47 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301829 Archived-At: > diff --git a/src/xdisp.c b/src/xdisp.c > index 06c8b7730c..4e5250486f 100644 > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -16838,6 +16838,13 @@ redisplay_internal (void) > /* Only GC scrollbars when we redisplay the whole frame. */ > = f->redisplay || !REDISPLAY_SOME_P (); > bool f_redisplay_flag = f->redisplay; > + > + /* The X error handler may have deleted that frame > + before we went back to retry_frame. This must come > + before any accesses to f->terminal. */ > + if (!FRAME_LIVE_P (f)) > + continue; > + > /* Mark all the scroll bars to be removed; we'll redeem > the ones we want when we redisplay their windows. */ > if (gcscrollbars && FRAME_TERMINAL (f)->condemn_scroll_bars_hook) > @@ -16845,7 +16852,6 @@ redisplay_internal (void) > > if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f)) > { > - > /* Don't allow freeing images and faces for this > frame as long as the frame's update wasn't > completed. This prevents crashes when some Lisp > @@ -16861,10 +16867,6 @@ redisplay_internal (void) > else if (!REDISPLAY_SOME_P ()) > f->redisplay = true; > > - /* The X error handler may have deleted that frame. */ > - if (!FRAME_LIVE_P (f)) > - continue; > - > /* Any scroll bars which redisplay_windows should have > nuked should now go away. */ > if (gcscrollbars && FRAME_TERMINAL (f)->judge_scroll_bars_hook) Any reason not to have this test in both places? I don't want to make unsafe changes on the release branch.