unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Antonio Carzaniga <antonio.carzaniga@usi.ch>
To: Po Lu <luangruo@yahoo.com>
Cc: 53420@debbugs.gnu.org
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	[thread overview]
Message-ID: <871r0zxyvl.fsf@usi.ch> (raw)
In-Reply-To: <87ilucwp1r.fsf@yahoo.com> (Po Lu's message of "Sat, 22 Jan 2022 09:13:20 +0800")

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 <luangruo@yahoo.com> writes:

> Antonio Carzaniga <antonio.carzaniga@usi.ch> 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-<up> maximizes the frame vertically, and I also pressed <down>, which
>> causes emacs to complain that s-<down> 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.





  reply	other threads:[~2022-01-22 21:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 15:49 bug#53420: 29.0.50; NULL cairo context while frame resize, causes segfault with visible-bell Antonio Carzaniga
2022-01-22  1:13 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-22 21:07   ` Antonio Carzaniga [this message]
2022-01-23  0:44     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-23 17:34       ` Antonio Carzaniga
2022-01-24  0:04         ` Po Lu 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=871r0zxyvl.fsf@usi.ch \
    --to=antonio.carzaniga@usi.ch \
    --cc=53420@debbugs.gnu.org \
    --cc=luangruo@yahoo.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).