From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuuki Harano Newsgroups: gmane.emacs.bugs Subject: bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times Date: Sun, 16 Jan 2022 00:08:12 +0900 Message-ID: <87tue5qboj.wl-masm+emacs@masm11.me> References: <87k0fj9hh2.fsf@melete.silentflame.com> <87ilurnnby.fsf@melete.silentflame.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Sun_Jan_16_00:08:11_2022-1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34172"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: Po Lu , 52941@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Sean Whitton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 15 16:09:41 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 1n8kgW-0008gx-Jf for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jan 2022 16:09:41 +0100 Original-Received: from localhost ([::1]:45788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n8kgU-0001oF-Nl for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jan 2022 10:09:38 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8kfv-0001nf-6B for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 10:09:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n8kfu-0003O1-TU for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 10:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n8kfu-0004TE-Pj for bug-gnu-emacs@gnu.org; Sat, 15 Jan 2022 10:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuuki Harano Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Jan 2022 15:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52941 X-GNU-PR-Package: emacs Original-Received: via spool by 52941-submit@debbugs.gnu.org id=B52941.164225931317133 (code B ref 52941); Sat, 15 Jan 2022 15:09:02 +0000 Original-Received: (at 52941) by debbugs.gnu.org; 15 Jan 2022 15:08:33 +0000 Original-Received: from localhost ([127.0.0.1]:41489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8kfQ-0004SG-Qw for submit@debbugs.gnu.org; Sat, 15 Jan 2022 10:08:32 -0500 Original-Received: from shiro.masm11.me ([150.95.182.25]:50472) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8kfM-0004Rt-Er for 52941@debbugs.gnu.org; Sat, 15 Jan 2022 10:08:31 -0500 Original-Received: from luna.pink.masm11.me (i153-144-34-242.s41.a033.ap.plala.or.jp [153.144.34.242]) by shiro.masm11.me (Postfix) with ESMTPA id 3E17CC00CB; Sun, 16 Jan 2022 00:08:23 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=masm11.me; s=202002; t=1642259303; bh=xN3+K+wmIDx0uLMHXt79m/3E1L6psIUDp5O36VJpFn4=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=eGubw0mSR50E1bu0m8ivQQbz+xI76EO1d7211kjyVn+lRHAWhn/H6mB4C53rH7L1G MRo06fUEzIbEDsWSmhNZUsAhMia/SWqyGWJPSPPGta1/4f2iTDblVWYPkSPlZuGjY9 rVo54KesdPODUNkkpimqGWZ8iwJWc53LL4cK9oH4= In-Reply-To: <87ilurnnby.fsf@melete.silentflame.com> 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:224314 Archived-At: --Multipart_Sun_Jan_16_00:08:11_2022-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Sun_Jan_16_00:08:11_2022-1 Content-Type: application/octet-stream; type=patch; name="events-processed-twice.diff" Content-Disposition: attachment; filename="events-processed-twice.diff" Content-Transfer-Encoding: 7bit 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; } --Multipart_Sun_Jan_16_00:08:11_2022-1--