From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kai Ma Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] On the nasty "ghost key" problem on NS Date: Fri, 4 Nov 2022 16:53:34 +0800 Message-ID: <394D8618-AF36-44C4-BA64-7AFDFBBDC429@gmail.com> References: <87leord0ei.fsf@yahoo.com> <87h6zfchpu.fsf@yahoo.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40485"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 04 09:54:35 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oqsTC-000AIL-Gw for ged-emacs-devel@m.gmane-mx.org; Fri, 04 Nov 2022 09:54:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqsSY-0004AT-V7; Fri, 04 Nov 2022 04:53:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqsSW-00049z-9t for emacs-devel@gnu.org; Fri, 04 Nov 2022 04:53:52 -0400 Original-Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqsSU-0006Ma-RE for emacs-devel@gnu.org; Fri, 04 Nov 2022 04:53:52 -0400 Original-Received: by mail-pl1-x644.google.com with SMTP id v17so4308137plo.1 for ; Fri, 04 Nov 2022 01:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ym43o+h6XyOmLSlc8BFq/4t5tEteOSmNxzG/UHQLAKQ=; b=IoIvyKi31TZhlwF1hP+M48USozC6vhU7vaKIhnYmS/s7EkSo0YUxsO2eLuVCHcjmL0 l9pfad+frnMkIh6eygqA0+afqxORyqeS0euIBFHGcLxTxyNWvbumU/5jbFGiLjxuRoTU mNRqMuSoPtGVjFpkiHjrij8TNzwZw+28yY1aBWk+7B1pfHmVNJj8mReMdkZc1SZ7/DcF WmvFAWazeAkUDTrHMFQ6/w/7dq/RUuhw4zsQFbsa+NXpUhr+9adzYO7r0BrNsKm6eog+ lz12lBBzkFAgGS4pPxDbKqo01uX1XxuUh1kvvdiTSgWh0Z6soMHk0q+ypEmrHz/RUmQJ UvTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ym43o+h6XyOmLSlc8BFq/4t5tEteOSmNxzG/UHQLAKQ=; b=LfCtmk0tUFnIjpqkpOHnCNbC88J4F9PTDS0SouUPHjpy4FJhw1NVVNf6FQnEzvRt7/ OPrrnrlZ2jM3bgfIP9NvU4wJbis8EBmv+Y6/wg2GmRIRxXf6+cV3FNOTf68afDy+H0dF b1ir5a2VBQbfkp1k6zF9/+RQi/IRa4jO0HvNrhCb6oq/6t/hMExF2V85G+C60wqtWbzz cJyZCsZlkUnwYqtihXTiImAPI3YASfhDzYPj2aCBOPQ3m+GJas0mVowWj80vxUtREsgP oVM/YcDJU6HQX8VC+SmPWProhDG6qJnQMXxoMQBKh81RcEPNFXYxROVqMmvyCSovsgSY ++Ag== X-Gm-Message-State: ACrzQf1iS1Jqol2PorVP+tnJnJz5lxrLRKvgsx0DZZzf/sD84j4FraDY 6Si3Bbuy7N0TcJAATNaXk88= X-Google-Smtp-Source: AMsMyM42OfpgXkJB87LfBrWKFCKWafOSSMquOyoPWFiHZgto0iNGQY6n6BWfS8oQEvNNhIl0zdQ0Fg== X-Received: by 2002:a17:902:aa8b:b0:178:8f1d:6936 with SMTP id d11-20020a170902aa8b00b001788f1d6936mr34576835plr.168.1667552029229; Fri, 04 Nov 2022 01:53:49 -0700 (PDT) Original-Received: from smtpclient.apple (n058153105218.netvigator.com. [58.153.105.218]) by smtp.gmail.com with ESMTPSA id c24-20020aa79538000000b00528a097aeffsm2125873pfp.118.2022.11.04.01.53.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Nov 2022 01:53:48 -0700 (PDT) In-Reply-To: <87h6zfchpu.fsf@yahoo.com> X-Mailer: Apple Mail (2.3731.200.110.1.12) Received-SPF: pass client-ip=2607:f8b0:4864:20::644; envelope-from=justksqsf@gmail.com; helo=mail-pl1-x644.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299117 Archived-At: > On Nov 4, 2022, at 15:16, Po Lu wrote: >=20 > Kai Ma writes: >=20 >> I=E2=80=99ve narrowed the problem further to [firstRectForCharRange]. >=20 > I'm either blind, or there is no method by that name... firstRectForCharacterRange. >=20 >> Some calls never return. Activating an input method makes Emacs issue >> excessive calls to this method. Specifically, the following code gets >> stuck somewhere. >>=20 >> if (WINDOWP (echo_area_window) && ! NILP (call0 (intern = ("ns-in-echo-area")))) >> win =3D XWINDOW (echo_area_window); >> else >> win =3D XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); >=20 > So Emacs completely locks up in that function (ns-in-echo-area)? Yes and no. Emacs still responds to new key events, but a previous call = is stuck and does not return. Presumably in another thread. To be more = clear: changing that code to be static int enter_cnt, leave_cnt; enter_cnt++; [referenced piece of code] leave_cnt++; /* (Or just count the return/leave counts of (ns-in-echo-area).) */ leave_cnt can be less than enter_cnt. I=E2=80=99ve confirmed re-entrance = to [firstRectForCharacterRange] leads to the problem. Pardon my ignorance, is there any reason to special-case the echo area? = Simply let win =3D XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)) and the = problem is gone.=