all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: bug#60144: 30.0.50; PGTK Emacs crashes after signal
Date: Thu, 22 Dec 2022 11:04:05 +0200	[thread overview]
Message-ID: <83wn6j95dm.fsf@gnu.org> (raw)
In-Reply-To: <871qosb50l.fsf@yahoo.com> (message from Po Lu on Thu, 22 Dec 2022 09:28:58 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Thu, 22 Dec 2022 09:28:58 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Under the GTK builds, there is only a single thread.  The event loop
> >> runs from the main thread.  Those calls to note_mouse_highlight *are*
> >> being done from the main thread.  The problem is that it is unsafe to
> >> signal in the main thread when handle_one_xevent is being called by
> >> GLib, because GLib does the equivalent of this:
> >> 
> >>   static bool inside_callback;
> >> 
> >>   assert (!inside_callback);
> >>   inside_callback = true;
> >>   [call handle_one_xevent]
> >>   inside_callback = false;
> >> 
> >> If handle_one_xevent signals, then inside_callback will never be set to
> >> false.  As a result, the next time GLib enters its own event dispatch
> >> code, it will abort, leading to the crash seen here.
> >
> > OK, so then I ask again: why not have the function called by GTK just
> > enqueue events and return, and then let read_socket_hook read the
> > enqueued events and process them as they are read, in keyboard.c?
> 
> After the function returns, it is not guaranteed that Emacs will be able
> to enter read_socket_hook soon.

Why is that a problem?  If the event we queue includes all the data
needed for processing it, why does it matter how soon it is processed?

And what could delay the processing significantly in this scenario?
Since these callbacks are called from the main thread, it means Emacs
is not busy, and should return to the main loop very soon.  Right?



  reply	other threads:[~2022-12-22  9:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-17  3:39 bug#60144: 30.0.50; PGTK Emacs crashes after signal Karl Otness via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-18  2:08 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-18  5:45   ` Eli Zaretskii
2022-12-18  6:22     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-18  8:39       ` Eli Zaretskii
2022-12-18  9:52         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-18 11:43           ` Eli Zaretskii
2022-12-18 12:12             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-18 12:33               ` Eli Zaretskii
2022-12-18 13:45                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-18 17:34                   ` Eli Zaretskii
2022-12-19  1:56                     ` Po Lu
2022-12-19 14:36                       ` Eli Zaretskii
2022-12-20  1:39                         ` Po Lu
2022-12-20 15:16                           ` Eli Zaretskii
2022-12-21  1:01                             ` Po Lu
2022-12-21 13:06                               ` Eli Zaretskii
2022-12-22  1:28                                 ` Po Lu
2022-12-22  9:04                                   ` Eli Zaretskii [this message]
2022-12-22  9:57                                     ` Po Lu

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wn6j95dm.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.