From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#31312: Segmentation fault with doom-emacs, NeoTree and Zoom Date: Wed, 02 May 2018 15:45:31 +0300 Message-ID: <0DFE6C67-38C5-45EE-B658-8BEF80B595FF@gnu.org> References: <87r2mvo6c8.fsf@gmail.com> <5AE87AA3.6050602@gmx.at> <87o9hznfam.fsf@gmail.com> <5AE957BA.6000809@gmx.at> <87fu3ant8k.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1525265047 32716 195.159.176.226 (2 May 2018 12:44:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 May 2018 12:44:07 +0000 (UTC) User-Agent: K-9 Mail for Android Cc: cyrus.and@gmail.com To: 31312@debbugs.gnu.org, npostavs@gmail.com, rudalics@gmx.at Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 02 14:44:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDr74-0008NO-36 for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 May 2018 14:44:02 +0200 Original-Received: from localhost ([::1]:50284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDr9B-0006Gn-6c for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 May 2018 08:46:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDr95-0006GZ-3K for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 08:46:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDr90-0002HM-6l for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 08:46:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38565) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fDr90-0002Gs-29 for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 08:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fDr8z-00083B-RW for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 08:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 May 2018 12:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31312 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed X-Debbugs-Original-To: bug-gnu-emacs@gnu.org, Noam Postavsky , martin rudalics X-Debbugs-Original-Cc: 31312@debbugs.gnu.org, Andrea Cardaci Original-Received: via spool by submit@debbugs.gnu.org id=B.152526515230915 (code B ref -1); Wed, 02 May 2018 12:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 May 2018 12:45:52 +0000 Original-Received: from localhost ([127.0.0.1]:46459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDr8p-00082Z-VB for submit@debbugs.gnu.org; Wed, 02 May 2018 08:45:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDr8o-00082N-NH for submit@debbugs.gnu.org; Wed, 02 May 2018 08:45:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDr8i-00025i-80 for submit@debbugs.gnu.org; Wed, 02 May 2018 08:45:45 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:56165) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fDr8i-00025X-50 for submit@debbugs.gnu.org; Wed, 02 May 2018 08:45:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDr8g-0006GK-K1 for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 08:45:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDr8b-000227-NR for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 08:45:42 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDr8b-000223-JZ; Wed, 02 May 2018 08:45:37 -0400 Original-Received: from [109.253.190.64] (port=43460 helo=[10.128.97.191]) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1fDr8a-0002Ci-Rp; Wed, 02 May 2018 08:45:37 -0400 In-Reply-To: <87fu3ant8k.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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: 208.118.235.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:145920 Archived-At: On May 2, 2018 3:21:15 PM GMT+03:00, Noam Postavsky = wrote: > martin rudalics writes: >=20 > > and the only ways this could cause w !=3D XWINDOW(selected_window) > > before the last call is either !WINDOWP (selected_window) or that > > clear_garbaged_frames or prepare_menu_bars change selected_window=2E > > Can you find the responsible? >=20 > Yes, found it, seems to be a combination of zoom > window-size-change-functions called via prepare_menu_bars and doom > advice on balance-windows=2E I got 12 changes of selected_window=2E=20 > First > hit summarized inline, the rest of the backtraces are attached below=2E >=20 > #0 select_window_1 (window=3DXIL(0x1601c35), inhibit_point_swap=3Dfalse= ) > at =2E=2E/=2E=2E/src/window=2Ec:562 > #1 0x00000000004aff15 in select_window (window=3DXIL(0x1601c35), > norecord=3DXIL(0xc090), inhibit_point_swap=3Dfalse) at > =2E=2E/=2E=2E/src/window=2Ec:520 > #2 0x00000000004b0183 in Fselect_window (window=3DXIL(0x1601c35), > norecord=3DXIL(0xc090)) at =2E=2E/=2E=2E/src/window=2Ec:590 > #3 0x00000000004beaa7 in Fdelete_window_internal > (window=3DXIL(0x1696c35)) at =2E=2E/=2E=2E/src/window=2Ec:4667 >=20 > #79 0x0000000000441b1a in safe_call1 (fn=3DXIL(0x4a9e6d0), > arg=3DXIL(0x1600c35)) at =2E=2E/=2E=2E/src/xdisp=2Ec:2644 > #80 0x00000000004bb27a in run_window_size_change_functions > (frame=3DXIL(0x1600c35)) at =2E=2E/=2E=2E/src/window=2Ec:3457 > #81 0x0000000000460409 in prepare_menu_bars () at > =2E=2E/=2E=2E/src/xdisp=2Ec:12065 > #82 0x0000000000465141 in redisplay_internal () at > =2E=2E/=2E=2E/src/xdisp=2Ec:13937 > #83 0x0000000000463c16 in redisplay () at =2E=2E/=2E=2E/src/xdisp=2Ec:13= 518 >=20 > Lisp Backtrace: > [=2E=2E=2E] > "delete-window" (0xffff9ab0) > [=2E=2E=2E] > "doom/popup-close" (0xffffa068) > [=2E=2E=2E] > "doom*popups-save" (0xffffaa00) > [=2E=2E=2E] > "ad-Advice-balance-windows" (0xffffb530) > "apply" (0xffffb528) > "balance-windows" (0xffffb960) > "let" (0xffffbcc0) > "zoom--update" (0xffffbe10) > [=2E=2E=2E] > "zoom--handler" (0xffffc928) > "redisplay_internal (C function)" (0x0) >=20 > (defun zoom--on () > [=2E=2E=2E] > (add-hook 'window-size-change-functions #'zoom--handler) >=20 > (defun zoom--handler (&optional window-or-frame norecord) > [=2E=2E=2E] > (with-selected-window > [=2E=2E=2E] > (zoom--update)))) >=20 > (defun zoom--update () > "Update the window layout in the current frame=2E" > (let (;; temporarily disables this mode during resize to avoid > infinite > ;; recursion (probably not needed thanks to the following) > (zoom-mode nil) > ;; temporarily disable all (even external) hooks about window > ;; configuration changes to try to avoid potential flickering since > ;; `balance-windows' calls them > (window-configuration-change-hook nil) > ;; make sure that other windows are resized nicely after resizing the > ;; selected one > (window-combination-resize t) > ;; make sure that the exact same amount of pixels is assigned to all > the > ;; siblings > (window-resize-pixelwise t)) > ;; start from a balanced layout anyway > (balance-windows) > ;; check if the selected window is not ignored > (unless (zoom--window-ignored-p) > (zoom--resize) > (zoom--fix-scroll)))) >=20 > ;; doom/core/core-popups=2Eel: > (advice-add #'balance-windows :around #'doom*popups-save) >=20 > (defun doom*popups-save (orig-fn &rest args) > "Sets aside all popups before executing the original function, usually > to > prevent the popup(s) from messing up the UI (or vice versa)=2E" > (save-popups! (apply orig-fn args))) >=20 > (defmacro save-popups! (&rest body) > "Sets aside all popups before executing the original function, usually > to > prevent the popup(s) from messing up the UI (or vice versa)=2E" > `(let ((in-popup-p (doom-popup-p)) > (popups (doom-popup-windows)) > (doom-popup-remember-history t) > (doom-popup-inhibit-autokill t)) > (when popups > (mapc #'doom/popup-close popups)) > (unwind-protect > (progn ,@body) > (when popups > (let ((origin (selected-window))) > (doom/popup-restore) > (unless in-popup-p > (select-window origin))))))) So we need the same defense after prepare_menu_bars as we have after do_pending_changes, I think=2E