From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#38966: 27.0.60; Assertion failure in set_cursor_from_row Date: Mon, 6 Jan 2020 10:19:02 +0100 Message-ID: <497636f5-1728-1e7e-b826-8310e2a6fe13@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F2C71189F0B188B8A99F833D" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="197462"; mail-complaints-to="usenet@blaine.gmane.org" To: 38966@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 06 10:20:58 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ioOZE-000pDk-WC for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 Jan 2020 10:20:57 +0100 Original-Received: from localhost ([::1]:49672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioOZD-0000HM-LZ for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 Jan 2020 04:20:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53190) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioOYN-0008TQ-EG for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 04:20:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioOYL-0001RO-Sy for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 04:20:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ioOYL-0001RF-PW for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 04:20:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ioOYL-0004I4-LU for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 04:20:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Jan 2020 09:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38966 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Bug-Gnu-Emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.157830235016407 (code B ref -1); Mon, 06 Jan 2020 09:20:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Jan 2020 09:19:10 +0000 Original-Received: from localhost ([127.0.0.1]:45002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ioOXW-0004GY-66 for submit@debbugs.gnu.org; Mon, 06 Jan 2020 04:19:10 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:60295) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ioOXU-0004GR-8C for submit@debbugs.gnu.org; Mon, 06 Jan 2020 04:19:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52993) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioOXS-0008K1-Ey for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 04:19:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioOXQ-0000YZ-TC for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 04:19:06 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:53357) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ioOXQ-0000WE-FP for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 04:19:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1578302342; bh=tP/ErOrHOTRU7FrCwcqEfpo3HhHP/oy52VE6KZebmis=; h=X-UI-Sender-Class:To:From:Subject:Date; b=DngPcTFCPEzHxE3OvXSFcmiIPw8y9byH/nc/h339mjh5ASmKOPVoKDS0Rskq+KR7B aSoacScEzkEa4/JqoW1X5HJ7NediMfNYU3jbPS69aNoF2IX+M9yLkq2K8oKa9MYfD4 GRsKUvln8ri1vMmEbjTHtvD79JO+3i4o2lKVgSgI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.101] ([212.95.5.81]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MNbkp-1j3QBq3Njn-00P4kW for ; Mon, 06 Jan 2020 10:19:01 +0100 Content-Language: de-AT X-Provags-ID: V03:K1:VaO2ViKnCrvtFRFa0IvVRSStgKg9NlmhgHsBoGjHYpHbRC6QyXG 6Vlwoz0mIWgTvb17llM/y4LW1+r99N4fgXPxYYX8rVVowr7ZcmnwqQ6QD3JeRlqFr8KmiUx NeCsflrPibOPL0fbxaCh9MNv07nMx5oMT+kskMTo59iVFtXmezkoBDuEica+BHjVqYbliVS eu7UMSbCJu8j0vu/vmNMg== X-UI-Out-Filterresults: notjunk:1;V03:K0:/eYiNbGcWi0=:UiQqauBCremL3/JjrIseYN tw5JfIgjoHsaBiSf5Fs0pM/GzU/YHU7RewhVVhsrjRZ3b4tY7NigqRCqEEvqw+yFqg+kbiBvk Q5wz+fcWqAfc5LnBaBjobrHpJjwO2Dl0CmX5jzOSwu+995CjAAniyCc8LTCZd0lhqGtV84Fd5 9Jl9ZYILG1PqcoXsTPQ0CurmWgOO7DWQMNJQ/WTYw0L13e6JvlZPm0FUTBum/EduxU2YAQ8Zn Nc2gv/qPY2WeriBfINzZY9/3PquNRcl3LJrxNmu5lUvWRd9O0+0SO0D7/jzkTFBa9e6BaFJ0X Up+x+siL8pWiYp6yYH0LPij648zDrR4frI+ntqHkDISxkU6B0aTVx1yBuIzfBll/+VycIpGjb Ylj3G7JuYiEX6HEN9Vvu725VXocfVK6b/CwXQuovc4W+6VpQuVLCQVx9bu8B2O5rcv8tICpNA 2RflBQqaD1JhHBghTa6JKUAIOzAuRsHun3aJXeNwoSfWrnHvaDr54Taf9ValpCphVtEK01oT9 tpnC41YaktQL5W+fafBjcpB7/Beup4u+uUzbgltXyiwvY/GQZBNIzDLKslIHFtx0t5l2TU0yH Mc0Vm+vZG/He4sRrHDZlcwii37DmNu3TGIyWVNATiPg1E3jMiz6c+0TLA/HjfyPhEqRHS5tIN 84xDXcXo47qWwkuuAEZPPmmu7NRH2tcjCTYxsbcoOX985Ve+BoIVWHBzytz8sNK7K08pqHzhb 4msdHo+2loE3mnPRcFVFcjmCwYYpqvmgBKIS/3diX7+gT28aRAa9C69u9x5G0M4BqavjudJd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:174226 Archived-At: This is a multi-part message in MIME format. --------------F2C71189F0B188B8A99F833D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit In GNU Emacs 27.0.60 (build 13, x86_64-w64-mingw32) of 2020-01-05 built on MACHNO Repository revision: 7f01dfca5600fcd3e3548aee50734aab4b96b02f Repository branch: emacs-27 With emacs -Q load the attached test-set-cursor-from-row.el and use the mouse to drag the upper mode line up and down. As soon as one of the windows gets sufficiently small, I get an assertion failure like Thread 1 hit Breakpoint 1, terminate_due_to_signal (sig=22, backtrace_limit=2147483647) at ../../src/emacs.c:371 371 signal (sig, SIG_DFL); (gdb) bt #0 terminate_due_to_signal (sig=22, backtrace_limit=2147483647) at ../../src/emacs.c:371 #1 0x00000004002c13cd in die (msg=0x400974295 "!row->mode_line_p", file=0x400970642 "../../src/xdisp.c", line=16249) at ../../src/alloc.c:7246 #2 0x000000040007ca89 in set_cursor_from_row (w=0x76c8500, row=0x76b0070, matrix=0x76cd580, delta=0, delta_bytes=0, dy=0, dvpos=0) at ../../src/xdisp.c:16249 #3 0x0000000400087177 in redisplay_window (window=XIL(0x76c8505), just_this_one_p=false) at ../../src/xdisp.c:18780 #4 0x000000040007c87c in redisplay_window_0 (window=XIL(0x76c8505)) at ../../src/xdisp.c:16190 #5 0x000000040031a182 in internal_condition_case_1 (bfun=0x40007c83d , arg=XIL(0x76c8505), handlers=XIL(0x6421ebb), hfun=0x40007c801 ) at ../../src/eval.c:1379 #6 0x000000040007c7d3 in redisplay_windows (window=XIL(0x76c8505)) at ../../src/xdisp.c:16170 #7 0x000000040007c785 in redisplay_windows (window=XIL(0x76c82f5)) at ../../src/xdisp.c:16164 #8 0x000000040007b0ad in redisplay_internal () at ../../src/xdisp.c:15638 #9 0x00000004000789af in redisplay () at ../../src/xdisp.c:14865 #10 0x00000004001b6162 in read_char (commandflag=1, map=XIL(0x77dcfb3), prev_event=XIL(0), used_mouse_menu=0xbff25f, end_time=0x0) at ../../src/keyboard.c:2493 #11 0x00000004001c93dd in read_key_sequence (keybuf=0xbff490, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at ../../src/keyboard.c:9553 #12 0x00000004001b28fc in command_loop_1 () at ../../src/keyboard.c:1350 #13 0x000000040031a08d in internal_condition_case (bfun=0x4001b23c6 , handlers=XIL(0x90), hfun=0x4001b1807 ) at ../../src/eval.c:1355 #14 0x00000004001b1f3c in command_loop_2 (ignore=XIL(0)) at ../../src/keyboard.c:1091 #15 0x00000004003194e2 in internal_catch (tag=XIL(0xdfe0), func=0x4001b1f0a , arg=XIL(0)) at ../../src/eval.c:1116 #16 0x00000004001b1e92 in command_loop () at ../../src/keyboard.c:1070 #17 0x0000000000000000 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Lisp Backtrace: "redisplay_internal (C function)" (0x0) The immediate cause is that the *scratch* window has a header _and_ a tab line. Disabling either of these makes the failure disappear. The culprit is IIUC this part of xdisp.c /* Finally, fall back on the first row of the window after the header line (if any). This is slightly better than not displaying the cursor at all. */ if (!row) { row = matrix->rows; if (row->mode_line_p) ++row; } set_cursor_from_row (w, row, matrix, 0, 0, 0, 0); which is no more valid because the first row is now the tab line of the *scratch* window. In this case the line we get by ++row is the header line triggering the subsequent assertion failure /* Don't even try doing anything if called for a mode-line or header-line row, since the rest of the code isn't prepared to deal with such calamities. */ eassert (!row->mode_line_p); if (row->mode_line_p) return false; If my analysis is correct, we should probably skip two lines to move to the first text line of the window. But I would not exclude the possibility (I have not tried to produce such behavior yet) that that third line does not even exist (what would the "(if any)" in the comment otherwise allude to?) or at least is the mode line of that window and the assertion failure would trigger again. So I think we should do two things there: (1) skip subsequent lines with row->mode_line_p enabled and (2) not call set_cursor_from_row when we have consumed all rows. BTW: I would also recommend to rename mode_line_p to something like say "no_text_line_p". Presently, people like me not used to hack the display code, might consider mode_line_p verbatim and not apply its semantics to header or tab lines. martin --------------F2C71189F0B188B8A99F833D Content-Type: text/plain; charset=UTF-8; name="test-set-cursor-from-row.el" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test-set-cursor-from-row.el" KHByb2duDQogICh0YWItbGluZS1tb2RlIDEpDQogIChydWxlci1tb2RlIDEpDQogIChzZXRx DQogIC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