From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andrea Cardaci Newsgroups: gmane.emacs.bugs Subject: bug#31312: Segmentation fault with doom-emacs, NeoTree and Zoom Date: Wed, 2 May 2018 15:27:12 +0200 Message-ID: References: <87r2mvo6c8.fsf@gmail.com> <5AE87AA3.6050602@gmx.at> <87o9hznfam.fsf@gmail.com> <5AE957BA.6000809@gmx.at> <87fu3ant8k.fsf@gmail.com> <0DFE6C67-38C5-45EE-B658-8BEF80B595FF@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1134e2ba6d6371056b390b60" X-Trace: blaine.gmane.org 1525267581 4474 195.159.176.226 (2 May 2018 13:26:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 May 2018 13:26:21 +0000 (UTC) Cc: 31312@debbugs.gnu.org, npostavs@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 02 15:26:08 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 1fDrln-0000o7-HR for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 May 2018 15:26:07 +0200 Original-Received: from localhost ([::1]:50460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDrnu-0001Ev-Fy for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 May 2018 09:28:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDrni-0001Ek-Vm for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 09:28:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDrne-00074h-9m for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 09:28:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38579) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fDrne-00074Z-6Z for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 09:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fDrnd-0000ja-SD for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 09:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Cardaci Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 May 2018 13:28: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-Cc: martin rudalics , bug-gnu-emacs@gnu.org, Noam Postavsky , 31312@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15252676572790 (code B ref -1); Wed, 02 May 2018 13:28:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 May 2018 13:27:37 +0000 Original-Received: from localhost ([127.0.0.1]:46476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDrnE-0000iu-8J for submit@debbugs.gnu.org; Wed, 02 May 2018 09:27:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50851) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDrnD-0000ii-4N for submit@debbugs.gnu.org; Wed, 02 May 2018 09:27:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDrn5-0006rn-Rg for submit@debbugs.gnu.org; Wed, 02 May 2018 09:27:29 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48346) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fDrn5-0006rf-NI for submit@debbugs.gnu.org; Wed, 02 May 2018 09:27:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDrn0-0001Bj-T6 for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 09:27:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDrmz-0006oH-72 for bug-gnu-emacs@gnu.org; Wed, 02 May 2018 09:27:22 -0400 Original-Received: from mail-qk0-x230.google.com ([2607:f8b0:400d:c09::230]:41288) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fDrmr-0006g9-R5; Wed, 02 May 2018 09:27:13 -0400 Original-Received: by mail-qk0-x230.google.com with SMTP id d125so11172506qkb.8; Wed, 02 May 2018 06:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QzEPqZjR09eo8MJcr1y7f8hkB2yxcW9W7pn7U9VCEQA=; b=QhfnwCI6QVEGlIOen1IXWftOh884JgpuuWv+dTcUucVYiydhUmMeo3GkqVxTDLB7kQ eGtZrj3crtiHVGqLRpvstQd6VTiWI3YAt6A/koAWwBMl3kEXf5zHR1WUQmFnOUIPzp3D /5ZAsYTLfwPoOLCg0cngetywgbexSxs2thI0uUbmj5n0RnMXqW7ufewRjhqR68xncCf0 DrEDNZcE1Hl2wFQwRA8FJ105PaQeqjYHkaD6hnnUuw4quCyYdnWJ+ms7quvJxVBmvx3J +6Sak59gn+xktam/rsR53CG6dj64JlIDq4leAU2E106TYOpJmX13JSdw1pAUm6zk7OjS tJig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QzEPqZjR09eo8MJcr1y7f8hkB2yxcW9W7pn7U9VCEQA=; b=HiORC1vaaPz1kkmoZ8FcXR5X+cuqgPzz3uUyiZWcNc0hOGrhnpSmUAxMhDEM2ki2cD 5jq9FcesvTU7Tz7pqFUEizKhLv5pTlS77cyj3wtNFApBxXPr19sWgYa9HF8V68jLCjN0 cgGdrDgJ9+/KaXiBBbz/BOJPtF1kqHnFESolSIMZryjGSsIUEB51RWM8O/62y1hUlue6 BXStePtmZGl6hFKc4abfIVrALcizY/V+L6oAF696aTapdINovFx7LjE1q1HQ8F1ZaL01 OQ4r7Bz9IrFJ6jn6mVRsDUBKSWfEcWyMpPWROgypdaL455XZxLQzIEy7FgJBRQRaefJK Mz/g== X-Gm-Message-State: ALQs6tDnWB03M7D7XvA5rWtUWwJNF4McKL4gA5zg+K9st/eTJ/LT0tuy lEfGmtl40EIe+MI0NUJyKQtF5BeCXZ0g+9bJoiOXH5Uc X-Google-Smtp-Source: AB8JxZrGyB5w3t3ofq2ynEidgWW9nryt8gLFKNpGDw1R/D8Nrp1NLusObDcRVOz2dmbooBR8B/KpK8K5FK/Xb+pixNg= X-Received: by 10.55.203.193 with SMTP id u62mr14431990qkl.83.1525267632577; Wed, 02 May 2018 06:27:12 -0700 (PDT) Original-Received: by 10.200.63.210 with HTTP; Wed, 2 May 2018 06:27:12 -0700 (PDT) In-Reply-To: <0DFE6C67-38C5-45EE-B658-8BEF80B595FF@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:145921 Archived-At: --001a1134e2ba6d6371056b390b60 Content-Type: text/plain; charset="UTF-8" > Also, please take a look at zoom.el: it hooks window-size-change-functions > and resizes the windows in that hook(!). > assuming that no one in their right > mind will change the configuration from a hook that notifies about > changes in configuration Yeah, I'm that guy... Any advice on this part? I needed to force the size of windows and hooking `select-window` (via `advice-add`) is apparently not enough to catch all the cases. Is there a better way to achieve what I want? On 2 May 2018 at 14:45, Eli Zaretskii wrote: > On May 2, 2018 3:21:15 PM GMT+03:00, Noam Postavsky > wrote: > > martin rudalics writes: > > > > > and the only ways this could cause w != XWINDOW(selected_window) > > > before the last call is either !WINDOWP (selected_window) or that > > > clear_garbaged_frames or prepare_menu_bars change selected_window. > > > Can you find the responsible? > > > > 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. I got 12 changes of selected_window. > > First > > hit summarized inline, the rest of the backtraces are attached below. > > > > #0 select_window_1 (window=XIL(0x1601c35), inhibit_point_swap=false) > > at ../../src/window.c:562 > > #1 0x00000000004aff15 in select_window (window=XIL(0x1601c35), > > norecord=XIL(0xc090), inhibit_point_swap=false) at > > ../../src/window.c:520 > > #2 0x00000000004b0183 in Fselect_window (window=XIL(0x1601c35), > > norecord=XIL(0xc090)) at ../../src/window.c:590 > > #3 0x00000000004beaa7 in Fdelete_window_internal > > (window=XIL(0x1696c35)) at ../../src/window.c:4667 > > > > #79 0x0000000000441b1a in safe_call1 (fn=XIL(0x4a9e6d0), > > arg=XIL(0x1600c35)) at ../../src/xdisp.c:2644 > > #80 0x00000000004bb27a in run_window_size_change_functions > > (frame=XIL(0x1600c35)) at ../../src/window.c:3457 > > #81 0x0000000000460409 in prepare_menu_bars () at > > ../../src/xdisp.c:12065 > > #82 0x0000000000465141 in redisplay_internal () at > > ../../src/xdisp.c:13937 > > #83 0x0000000000463c16 in redisplay () at ../../src/xdisp.c:13518 > > > > Lisp Backtrace: > > [...] > > "delete-window" (0xffff9ab0) > > [...] > > "doom/popup-close" (0xffffa068) > > [...] > > "doom*popups-save" (0xffffaa00) > > [...] > > "ad-Advice-balance-windows" (0xffffb530) > > "apply" (0xffffb528) > > "balance-windows" (0xffffb960) > > "let" (0xffffbcc0) > > "zoom--update" (0xffffbe10) > > [...] > > "zoom--handler" (0xffffc928) > > "redisplay_internal (C function)" (0x0) > > > > (defun zoom--on () > > [...] > > (add-hook 'window-size-change-functions #'zoom--handler) > > > > (defun zoom--handler (&optional window-or-frame norecord) > > [...] > > (with-selected-window > > [...] > > (zoom--update)))) > > > > (defun zoom--update () > > "Update the window layout in the current frame." > > (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)))) > > > > ;; doom/core/core-popups.el: > > (advice-add #'balance-windows :around #'doom*popups-save) > > > > (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)." > > (save-popups! (apply orig-fn args))) > > > > (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)." > > `(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. > --001a1134e2ba6d6371056b390b60 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> Also, please take a look at zoom.el: it hooks wi= ndow-size-change-functions
> and resizes the windows in th= at hook(!).

> assuming that no one in their rig= ht
> mind will change the configuration from a hook that notif= ies about
> changes in configuration

= Yeah, I'm that guy...

Any advice on this part?= I needed to force the size of windows and hooking `select-window`=C2=A0(via `advice-add`) is apparently= not enough to catch all the cases.

Is there a bet= ter way to achieve what I want?

<= div class=3D"gmail_quote">On 2 May 2018 at 14:45, Eli Zaretskii <eliz@gnu.org= > wrote:
On May 2, 2018 3:21:15 PM GMT+03:00, Noam Postavsky &= lt;npostavs@gmail.com> wrote:<= br> > martin rudalics <rudalics@gmx.at= > writes:
>
> > 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= .
> > Can you find the responsible?
>
> 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.=C2=A0 I got 12 changes of selected_window. =
> First
> hit summarized inline, the rest of the backtraces are attached below.<= br> >
> #0=C2=A0 select_window_1 (window=3DXIL(0x1601c35), inhibit_point_swap= =3Dfalse)
> at ../../src/window.c:562
> #1=C2=A0 0x00000000004aff15 in select_window (window=3DXIL(0x1601c35),=
> norecord=3DXIL(0xc090), inhibit_point_swap=3Dfalse) at
> ../../src/window.c:520
> #2=C2=A0 0x00000000004b0183 in Fselect_window (window=3DXIL(0x1601c35)= ,
> norecord=3DXIL(0xc090)) at ../../src/window.c:590
> #3=C2=A0 0x00000000004beaa7 in Fdelete_window_internal
> (window=3DXIL(0x1696c35)) at ../../src/window.c:4667
>
> #79 0x0000000000441b1a in safe_call1 (fn=3DXIL(0x4a9e6d0),
> arg=3DXIL(0x1600c35)) at ../../src/xdisp.c:2644
> #80 0x00000000004bb27a in run_window_size_change_functions
> (frame=3DXIL(0x1600c35)) at ../../src/window.c:3457
> #81 0x0000000000460409 in prepare_menu_bars () at
> ../../src/xdisp.c:12065
> #82 0x0000000000465141 in redisplay_internal () at
> ../../src/xdisp.c:13937
> #83 0x0000000000463c16 in redisplay () at ../../src/xdisp.c:13518
>
> Lisp Backtrace:
> [...]
> "delete-window" (0xffff9ab0)
> [...]
> "doom/popup-close" (0xffffa068)
> [...]
> "doom*popups-save" (0xffffaa00)
> [...]
> "ad-Advice-balance-windows" (0xffffb530)
> "apply" (0xffffb528)
> "balance-windows" (0xffffb960)
> "let" (0xffffbcc0)
> "zoom--update" (0xffffbe10)
> [...]
> "zoom--handler" (0xffffc928)
> "redisplay_internal (C function)" (0x0)
>
> (defun zoom--on ()
>=C2=A0 =C2=A0[...]
>=C2=A0 =C2=A0(add-hook 'window-size-change-functions #'zoom--ha= ndler)
>
> (defun zoom--handler (&optional window-or-frame norecord)
>=C2=A0 =C2=A0[...]
>=C2=A0 =C2=A0 =C2=A0(with-selected-window
>=C2=A0 =C2=A0 =C2=A0 =C2=A0[...]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(zoom--update))))
>
> (defun zoom--update ()
>=C2=A0 =C2=A0"Update the window layout in the current frame."=
> (let (;; temporarily disables this mode during resize to avoid
> infinite
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; recursion (probably not needed tha= nks to the following)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(zoom-mode nil)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; temporarily disable all (even exte= rnal) hooks about window
>=C2=A0 =C2=A0 ;; configuration changes to try to avoid potential flicke= ring since
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; `balance-windows' calls them >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(window-configuration-change-hoo= k nil)
>=C2=A0 ;; make sure that other windows are resized nicely after resizin= g the
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; selected one
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(window-combination-resize t)
> ;; make sure that the exact same amount of pixels is assigned to all > the
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; siblings
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(window-resize-pixelwise t))
>=C2=A0 =C2=A0 =C2=A0;; start from a balanced layout anyway
>=C2=A0 =C2=A0 =C2=A0(balance-windows)
>=C2=A0 =C2=A0 =C2=A0;; check if the selected window is not ignored
>=C2=A0 =C2=A0 =C2=A0(unless (zoom--window-ignored-p)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(zoom--resize)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(zoom--fix-scroll))))
>
> ;; doom/core/core-popups.el:
>=C2=A0 =C2=A0(advice-add #'balance-windows :around #'doom*popup= s-save)
>
> (defun doom*popups-save (orig-fn &rest args)
> "Sets aside all popups before executing the original function, us= ually
> to
> prevent the popup(s) from messing up the UI (or vice versa)."
>=C2=A0 =C2=A0(save-popups! (apply orig-fn args)))
>
> (defmacro save-popups! (&rest body)
> "Sets aside all popups before executing the original function, us= ually
> to
> prevent the popup(s) from messing up the UI (or vice versa)."
>=C2=A0 =C2=A0`(let ((in-popup-p (doom-popup-p))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (popups (doom-popup-windows))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (doom-popup-remember-history t)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (doom-popup-inhibit-autokill t))
>=C2=A0 =C2=A0 =C2=A0 (when popups
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (mapc #'doom/popup-close popups))
>=C2=A0 =C2=A0 =C2=A0 (unwind-protect
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (progn ,@body)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when popups
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((origin (selected-window))) >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (doom/popup-restore)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless in-popup-p
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (select-window origin)= ))))))

So we need the same defense after prepare_menu_bars as we
have after do_pending_changes, I think.

--001a1134e2ba6d6371056b390b60--