From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Antonio Carzaniga Newsgroups: gmane.emacs.bugs Subject: bug#53420: 29.0.50; NULL cairo context while frame resize, causes segfault with visible-bell Date: Sat, 22 Jan 2022 22:07:58 +0100 Message-ID: <871r0zxyvl.fsf@usi.ch> References: <877dateyyi.fsf@usi.ch> <87ilucwp1r.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21858"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 53420@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 22 22:09:22 2022 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 1nBNdS-0005Tt-4m for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jan 2022 22:09:22 +0100 Original-Received: from localhost ([::1]:52880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBNdQ-000655-VW for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jan 2022 16:09:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBNd8-00064i-7c for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 16:09:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45159) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBNd7-0007RI-R2 for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 16:09:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nBNd7-0006pH-MV for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 16:09:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Antonio Carzaniga Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jan 2022 21:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53420 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 53420-submit@debbugs.gnu.org id=B53420.164288568426151 (code B ref 53420); Sat, 22 Jan 2022 21:09:01 +0000 Original-Received: (at 53420) by debbugs.gnu.org; 22 Jan 2022 21:08:04 +0000 Original-Received: from localhost ([127.0.0.1]:38059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBNcC-0006ni-70 for submit@debbugs.gnu.org; Sat, 22 Jan 2022 16:08:04 -0500 Original-Received: from mail.usi.ch ([195.176.178.11]:36354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBNcA-0006nI-5v for 53420@debbugs.gnu.org; Sat, 22 Jan 2022 16:08:02 -0500 Original-Received: from siena (10.10.1.253) by USIMAIL4.usilu.net (10.10.0.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Sat, 22 Jan 2022 22:07:59 +0100 In-Reply-To: <87ilucwp1r.fsf@yahoo.com> (Po Lu's message of "Sat, 22 Jan 2022 09:13:20 +0800") X-Originating-IP: [10.10.1.253] X-ClientProxiedBy: USIMAIL4.usilu.net (10.10.0.84) To USIMAIL4.usilu.net (10.10.0.84) 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:224864 Archived-At: Thank you! But I think there's another problem now. Input is blocked. Shouldn't you get out of pgtk_flash *before* you call block_input, as in the patch below? (Or call unblock_input...) -Antonio diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 8073f51c61..c402dd3e74 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -3731,12 +3731,12 @@ recover_from_visible_bell (struct atimer *timer) static void pgtk_flash (struct frame *f) { + if (!FRAME_CR_CONTEXT (f)) + return; + block_input (); { - if (!FRAME_CR_CONTEXT (f)) - return; - cairo_surface_t *surface_orig = FRAME_CR_SURFACE (f); int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f); Po Lu writes: > Antonio Carzaniga writes: > >> M-x set-variable RET visible-bell >> >> Now resize the emacs frame and at the same time give a keyboard command >> that causes emacs to ring the bell. I know it's not a common thing to >> do, in fact I just happened to do that by mistake. Specifically for me, >> s- maximizes the frame vertically, and I also pressed , which >> causes emacs to complain that s- is undefined and therefore ring >> the bell. >> >> Anyway, now emacs crashes. A bit of analysis reveals the following >> sequence of events (logged using gdb) in which the cairo context >> associated with the selected frame is temporarily set to null during the >> frame-resize operation, and pgtk_ring_bell and then pgtk_flash are >> called before the cairo context is properly restored. > > Thanks, should be fixed now.