From: Yuuki Harano <masm+emacs@masm11.me>
To: Sean Whitton <spwhitton@spwhitton.name>
Cc: "Po Lu" <luangruo@yahoo.com>,
52941@debbugs.gnu.org, "João Távora" <joaotavora@gmail.com>
Subject: bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
Date: Sun, 16 Jan 2022 00:08:12 +0900 [thread overview]
Message-ID: <87tue5qboj.wl-masm+emacs@masm11.me> (raw)
In-Reply-To: <87ilurnnby.fsf@melete.silentflame.com>
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
On Tue, 11 Jan 2022 09:11:13 +0900,
Sean Whitton wrote:
> > If the system is under heavy load, and/or Emacs is compiled with debug
> > options which substantially slow it down, and fido-mode is enabled, then
> > typing quickly into the minibuffer can result in typed characters
> > inserted more than once.
Thanks for the report.
Please try the attached patch, which should solve the issue.
--
Yuuki Harano
[-- Attachment #2: events-processed-twice.diff --]
[-- Type: application/octet-stream, Size: 919 bytes --]
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 0155ae991d..5be9af7160 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -153,10 +153,24 @@ evq_enqueue (union buffered_input_event *ev)
evq_flush (struct input_event *hold_quit)
{
struct event_queue_t *evq = &event_q;
- int i, n = evq->nr;
- for (i = 0; i < n; i++)
- kbd_buffer_store_buffered_event (&evq->q[i], hold_quit);
- evq->nr = 0;
+ int n = 0;
+
+ while (evq->nr > 0)
+ {
+ /* kbd_buffer_store_buffered_event may do longjmp, so
+ we need to shift event queue first and pass the event
+ to kbd_buffer_store_buffered_event so that events in
+ queue are not processed twice. Bug#52941 */
+ union buffered_input_event ev = evq->q[0];
+ int i;
+ for (i = 1; i < evq->nr; i++)
+ evq->q[i - 1] = evq->q[i];
+ evq->nr--;
+
+ kbd_buffer_store_buffered_event (&ev, hold_quit);
+ n++;
+ }
+
return n;
}
next prev parent reply other threads:[~2022-01-15 15:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-01 23:14 bug#52941: 29.0.50; fido-mode: characters typed into minibuffers inserted multiple times Sean Whitton
2022-01-11 0:11 ` bug#52941: 29.0.50; pgtk: " Sean Whitton
2022-01-11 9:44 ` João Távora
2022-01-11 10:21 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-13 16:58 ` Sean Whitton
2022-01-14 0:39 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-14 21:30 ` Sean Whitton
2022-01-15 0:49 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-15 15:08 ` Yuuki Harano [this message]
2022-01-15 21:10 ` Sean Whitton
2022-01-16 8:45 ` Yuuki Harano
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=87tue5qboj.wl-masm+emacs@masm11.me \
--to=masm+emacs@masm11.me \
--cc=52941@debbugs.gnu.org \
--cc=joaotavora@gmail.com \
--cc=luangruo@yahoo.com \
--cc=spwhitton@spwhitton.name \
/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).