From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60144: 30.0.50; PGTK Emacs crashes after signal Date: Sun, 18 Dec 2022 21:45:38 +0800 Message-ID: <87wn6oesfx.fsf@yahoo.com> 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> <83bko0gact.fsf@gnu.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22289"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 60144@debbugs.gnu.org, karl@karlotness.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 18 14:46:17 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 1p6tzc-0005eE-11 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Dec 2022 14:46:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6tzQ-0007fA-5j; Sun, 18 Dec 2022 08:46:04 -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 1p6tzP-0007f1-3n for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 08:46:03 -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 1p6tzO-0007it-Rl for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 08:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6tzN-0003I4-Sz for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 08:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 13:46: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.167137116012640 (code B ref 60144); Sun, 18 Dec 2022 13:46:01 +0000 Original-Received: (at 60144) by debbugs.gnu.org; 18 Dec 2022 13:46:00 +0000 Original-Received: from localhost ([127.0.0.1]:34015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6tzM-0003Ho-7x for submit@debbugs.gnu.org; Sun, 18 Dec 2022 08:46:00 -0500 Original-Received: from sonic306-21.consmr.mail.ne1.yahoo.com ([66.163.189.83]:35573) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6tzJ-0003Hf-GY for 60144@debbugs.gnu.org; Sun, 18 Dec 2022 08:45:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1671371152; bh=pAJV0sH4ZTrHOi3iGiSNDsWaYlnXDTzqdAbeTwf3nOc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=JoLrpNkfja47Zb2apJDLjmiGn7UR6BCWiagwxNM1+AUzhyQEjz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QqDVyu4QlV.2xnvV 3_aEoTugBlbBtAz8HNrQnnX_c7H2iIi_1qXTHfC9taLTN9RgPyzdU4gMUYpF03C1_Bw3PPqRlzot dLhCBrwtUO07RaWF9yI9lEqtSQDqvU4nPjElWuDRXFYeRPRn.uXJDs1noSIIG6D1eYLruCOM.V7g i4pqMMwLLRv04djbRJ.U9EMjEbhQfilkY6jc4aXAFxP3HpBL1CglGXU1QtPhZ.Ek1JwWs.N17XXv VKIviF6K.SRw2IGWywCK5QH92Ny5mWMvRNe.DSG5TEbt7Vzhs7RDTL58qDlEr9nuoNf9RZiqAGIV diL4n_CVj2MoorGVvCXGKlixH24X2Et1IQOxJ112BDXvv.AW1PWYjcWSmBnDD.RrKdHPIkIbvLjT V7hyCEhpuupcbVUfs93N1Bc2FqthoMAalCEl4pr6W_ID_I2Q41n5OCmzmqDfwmhcSd5fPmdxxp5v sywwFlSqIXvA6xi680I6CLi96It1yi9ET8gBAlaZo_HHlExDKhSSVA74e.5pTvzbDOTzlzOl.zaJ FR8IJ8KSXZl.p_w3ts5Q5gMgTujHyqU_7PzP1nVuTJ X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Sun, 18 Dec 2022 13:45:52 +0000 Original-Received: by hermes--production-sg3-b666c6484-7wpvn (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 6d778dc2dec0b955081d7599e1b644e1; Sun, 18 Dec 2022 13:45:46 +0000 (UTC) In-Reply-To: <83bko0gact.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Dec 2022 14:33:22 +0200") X-Mailer: WebService/1.1.20982 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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:251367 Archived-At: Eli Zaretskii writes: >> 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? Because unblock_input can call process_pending_signals, and in doing so handle_async_input, which calls gobble_input (and thus the read_socket_hook.) As a result, it is not safe for any read_socket_hook to signal as long as it is not ok for unblock_input to signal as well. > 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? It doesn't, see how w32_note_mouse_movement is called from w32_read_socket. > 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. The problem is note_mouse_highlight is simply not supposed to signal. It is a function called directly while handling async input as far back as Emacs 19, much like expose_frame. (IIRC back then there was a slightly different implementation in each of the *term.c files.) Moving note_mouse_highlight out of handle_one_xevent would lead to other bugs, since mouse movement must be processed in order wrt to other X events. For example, if an XI_Motion event arrives and is queued, and then a subsequent XI_Leave event arrives before that event has a chance to be processed ``in our own safe context'', note_mouse_highlight will be called after the mouse has left the frame, leading to stuck mouse highlight.