From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60144: 30.0.50; PGTK Emacs crashes after signal Date: Sun, 18 Dec 2022 14:33:22 +0200 Message-ID: <83bko0gact.fsf@gnu.org> References: <87edsxfop0.fsf@yahoo.com> <83359dgt7v.fsf@gnu.org> <87a63lfcz7.fsf@yahoo.com> <83y1r5f6lh.fsf@gnu.org> <875ye9f385.fsf@yahoo.com> <83fsddey48.fsf@gnu.org> <871qowgbay.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39680"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60144@debbugs.gnu.org, karl@karlotness.com To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 18 13:34:24 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 1p6ss3-000A99-Iu for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Dec 2022 13:34:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6srl-0002b0-2D; Sun, 18 Dec 2022 07:34:05 -0500 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 1p6srh-0002a9-W8 for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 07:34:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6srh-00014q-Nm for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 07:34:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6srh-0002UJ-J0 for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 07:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 12:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60144 X-GNU-PR-Package: emacs Original-Received: via spool by 60144-submit@debbugs.gnu.org id=B60144.16713668039541 (code B ref 60144); Sun, 18 Dec 2022 12:34:01 +0000 Original-Received: (at 60144) by debbugs.gnu.org; 18 Dec 2022 12:33:23 +0000 Original-Received: from localhost ([127.0.0.1]:33716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6sr4-0002Tp-T1 for submit@debbugs.gnu.org; Sun, 18 Dec 2022 07:33:23 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6sr4-0002Tj-3i for 60144@debbugs.gnu.org; Sun, 18 Dec 2022 07:33:22 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6sqy-00010K-ET; Sun, 18 Dec 2022 07:33:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Tc64pNyvQD26pGE6Ok8cUEWyoaCDuZZb8U+AC7/UPT8=; b=C9OEN0kxd8QD EYJDm2w67+vR34ZFwHdGFrR3MimlpTJgKMKWvWC+8VdAAuNM6eNvMXV7G6h2UDfgL7DPJoLPS3Dd2 +wVBl8v+MGVgRUh8cndG+n17UtUZT2L+taRrF9DTahsTEwwp9SvCEoialq5nzqjLPzkgi3HReeRbZ 3kvZX8DMmYDBcNaCiAgzZ04ThPGx+D7rPjZAY02TVvAWt4i2oTKuZ2JsAkUxdqMn8MxRppYYkXZBT wBiVO8ZzqpXJzwOrJ7SZhBFfif2XHMQ7qLS39W6IpQeef0uRR8HUXaSkSEdDay+0yB4Fxnwy7TZxN bjvVv9EmjjD2EkUmeOAKEw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6sqx-00065x-PS; Sun, 18 Dec 2022 07:33:16 -0500 In-Reply-To: <871qowgbay.fsf@yahoo.com> (message from Po Lu on Sun, 18 Dec 2022 20:12:53 +0800) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251362 Archived-At: > From: Po Lu > Cc: karl@karlotness.com, 60144@debbugs.gnu.org > Date: Sun, 18 Dec 2022 20:12:53 +0800 > > Eli Zaretskii writes: > > >> No, signalling there is equally unsafe on the other platforms, where > >> note_mouse_highlight is called from the same place(s): read_socket_hook, > >> event_handler_gdk, et cetera. Just look at the callers of > >> x_note_mouse_movement in xterm.c, or [EmacsView mouseMoved:] in > >> nsterm.m. > > > > Sorry, I'm afraid I don't see the danger on other platforms. Please > > explain. AFAIK, read_socket_hook is called from keyboard.c code which > > reads input, and that code has no problem signaling an error. What am > > I missing? > > That code has problems signalling errors, unless it is okay for > unblock_input to signal. I don't understand this part. Why and how is unblock_input part of the picture? > On the regular X build with GTK, handle_one_xevent is called from > event_handler_gdk, which is called by GDK when it detects an event. > handle_one_xevent can also be called from x_dispatch_event inside a > popup menu, and during drag-and-drop. On NS, [EmacsView mouseMoved:] is > called by the system from Objective-C. So in the X/GTK build we have the same problem as with PGTK? If so, why not change that as well, to work as I described, i.e. enqueue events to our own event queue, which we will then read and process in safe context? AFAIU, w32 already works like that. Does it not? (As for NS, I know it does some very dangerous stuff.) > Out of all of those places, the only place where it is safe to signal is > inside the drag-and-drop event loop. Signalling out of the rest will > either lead to catastrophic blowups (if it happens inside > event_handler_gdk or [EmacsView mouseMoved:]), or to grabs never being > released and resource leaks inside a menu. Yes, understood. But it just tells me that we need to change the architecture so that the events delivered by the window-system are not processed in callbacks we install to be called by the window-system, they should be processed in our own safe context.