From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gong Qijian Newsgroups: gmane.emacs.bugs Subject: bug#74274: [PATCH] Revert part of d3f8ed730f to avoid segmentation fault Date: Fri, 8 Nov 2024 14:31:50 +0800 Message-ID: <20241108063148.30423-3-gongqijian@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19121"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gerd =?UTF-8?Q?M=C3=B6llmann?= , Gong Qijian To: 74274@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 09 02:21:30 2024 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 1t9aAL-0004pv-5U for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Nov 2024 02:21:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9a9w-0006GE-HV; Fri, 08 Nov 2024 20:21: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 1t9a9u-0006G1-Nc for bug-gnu-emacs@gnu.org; Fri, 08 Nov 2024 20:21:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t9a9u-0005HX-EY for bug-gnu-emacs@gnu.org; Fri, 08 Nov 2024 20:21:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=xU9ikRJbdI8BtkC/kG8AXLc2jX3Uwpu8OQmODf4/N3A=; b=b1Yl59psXM9KvMg78sEDUVbTr/wLKj0yOBjJA8x1VExfjiY+pFDmjsW8es7yETEW15jlw6t9d3mTFtMFBOzRx6XpiTFB+mORpKjJeQMDS2ealzOY9a5EG2noC3Axrp0woF1Yb+Sx3dO8o6AZMC80BSVFbeO5/ZVrH6QOq2+/EPpjG5r+J8jRkR8NBts603sRWNrOoFGyLOVFkucZY6NYeHbHO1zvr7FidAUtVmeSDBtBxRMbrXaoojnfI31dUCRVlk4ZmRcBo43VWnycd5NbmSplMIy1YptGLYoDH+iDDuxctfzpJurh6/kLhYB3CO9hTcGvO77KXGRm5QRgHPP9WA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t9a9u-0005eV-29 for bug-gnu-emacs@gnu.org; Fri, 08 Nov 2024 20:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gong Qijian Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Nov 2024 01:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173111523021675 (code B ref -1); Sat, 09 Nov 2024 01:21:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Nov 2024 01:20:30 +0000 Original-Received: from localhost ([127.0.0.1]:52706 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t9a9O-0005dX-7Q for submit@debbugs.gnu.org; Fri, 08 Nov 2024 20:20:30 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45846) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t9a9M-0005dP-Ow for submit@debbugs.gnu.org; Fri, 08 Nov 2024 20:20:29 -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 1t9a9L-0006EI-Ob for bug-gnu-emacs@gnu.org; Fri, 08 Nov 2024 20:20:28 -0500 Original-Received: from [58.17.93.74] (helo=MBP33.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9a9K-0005AQ-26; Fri, 08 Nov 2024 20:20:27 -0500 Original-Received: by MBP33.local (Postfix, from userid 501) id DF100BDC074; Fri, 8 Nov 2024 14:38:33 +0800 (CST) X-Mailer: git-send-email 2.42.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 58.17.93.74 (failed) Received-SPF: none client-ip=58.17.93.74; envelope-from=gqj@MBP33.local; helo=MBP33.local X-Spam_score_int: 46 X-Spam_score: 4.6 X-Spam_bar: ++++ X-Spam_report: (4.6 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NML_ADSP_CUSTOM_MED=0.9, NO_DNS_FOR_FROM=0.001, PP_MIME_FAKE_ASCII_TEXT=0.239, RCVD_IN_PBL=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, SPOOFED_FREEMAIL=0.001, SPOOFED_FREEMAIL_NO_RDNS=0.001, SPOOF_GMAIL_MID=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:295089 Archived-At: Patch for branch scratch/tty-child-frames to avoid segmentation fault. The issue can be triggered by the message function when creating a tty child frame during the initialization process. Reproduce: $ src/emacs -nw -Q --eval "\ (progn (require 'cl-lib) (require 'tty-tip) (advice-add 'tty-tip--compute-position :around (defun tty-tip--compute-position@fix-nil-error (&rest args) (cl-letf ((orig-mouse-position (symbol-function #'mouse-position)) ((symbol-function #'mouse-position) (lambda () (if (terminal-parameter nil 'xterm-mouse-x) (funcall orig-mouse-position) (cons (window-frame) (posn-x-y (posn-at-point))))))) (apply args)))) (tty-tip--create-frame \"line1\nline2\") (message \"tty-type: %S\" (tty-type)))" Fatal error 11: Segmentation fault ^[[Ifish: Job 1, 'src/emacs -nw -Q --eval "\…' terminated by signal (pro… (SIGABRT) fish: Job Abort, '' terminated by signal () --- src/term.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index a7f7baa6e3..8aeabd76b7 100644 --- a/src/term.c +++ b/src/term.c @@ -781,7 +781,11 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) { /* Identify a run of glyphs with the same face. */ int face_id = string->face_id; - struct frame *face_id_frame = string->frame; + /* FIXME/tty: it happens that a single glyph's frame is NULL. It + might depend on a tab bar line being present, then switching + from a buffer without header line to one with header line and + opening a child frame. */ + struct frame *face_id_frame = string->frame ? string->frame : f; for (n = 1; n < stringlen; ++n) if (string[n].face_id != face_id || string[n].frame != face_id_frame) -- 2.42.0