Subject: bug#71929: 30.0.60; crash in mark_image_cache

From: Sean Whitton <[email-masked]>
Date: Thu, 04 Jul 2024 17:56:04 +0800

Hello,

On Thu 04 Jul 2024 at 02:59pm +08, Po Lu wrote:

> Sean Whitton <[email-masked]> writes:
>
>> I don't know, but I will see if I can get information about these next
>> time I observe the crash.
>>
>> I struggle to keep the Emacs instance running gdb around very long
>> because it keeps crashing too :)
>
> What packages have you installed, and do they frequently create new
> frames or adjust the font size of existing frames?

The packages I have installed don't do that, but I have tonnes of custom
code in my init.el to create new frames and adjust font sizes.
I normally have >=three frames open for each of two instances of Emacs.

I have two entries in window-size-change-functions:

--8<---------------cut here---------------start------------->8---
(defun spw/maybe-scale-basic-faces (frame)
  "Entry for `window-size-change-functions' to increase font sizes,
relative to those set by the call to `custom-theme-set-faces' above, for
frames on wide monitors, except where doing so would itself prevent fitting
two 80-column windows side-by-side in the frame."
  (when (display-graphic-p frame)
   (let ((wide-monitor-p (> (cadddr (assoc 'geometry
					   (frame-monitor-attributes frame)))
			    1635)))
     (when (or wide-monitor-p
	       ;; Check whether a previous call made any changes we might need
	       ;; to undo if FRAME has moved to a smaller display.
	       (not (eq scroll-bar-mode
			(frame-parameter frame 'vertical-scroll-bars)))
	       (= (face-attribute 'default :height frame) 120)
	       (= (face-attribute 'variable-pitch :height frame) 151))
       (let* (;; Above 1635 you can scale up and still fit two 80-col windows.
	      ;; Below 1315 you can't fit the two windows even w/o scaling up.
	      (medium-p (> 1635 (frame-pixel-width frame) 1315))
	      (scale-up-p (and wide-monitor-p (not medium-p))))
	 (modify-frame-parameters
	  frame
	  `(;; Can fit two 80-col windows only if we disable scroll bars.
	    (vertical-scroll-bars . ,(and (not (and wide-monitor-p medium-p))
					  scroll-bar-mode))))
	 ;; Check Emacs found the relevant font on this window system, else
	 ;; our height values might be invalid.
	 (when (find-font (font-spec :foundry "SRC" :family "Hack") frame)
	   (set-face-attribute 'default frame
			       :height (if scale-up-p 120 105)))
	 (when (find-font (font-spec :foundry "bitstream"
				     :family "Bitstream Charter")
			  frame)
	   (set-face-attribute 'variable-pitch frame
			       :height (if scale-up-p 151 120))))))))
--8<---------------cut here---------------end--------------->8---

and

--8<---------------cut here---------------start------------->8---
(defun spw/maybe-toggle-split-after-resize (frame)
  (when (and (framep frame)
	     (frame-size-changed-p frame)
	     (= (count-windows nil frame) 2))
    (with-selected-frame frame
      (cl-labels ((toggleable-window-p (window)
		    (with-current-buffer (window-buffer window)
		      (not (derived-mode-p 'gnus-summary-mode))))
		  (window-info (window)
		    (and (toggleable-window-p window)
			 (cons (window-buffer window)
			       (cons (window-prev-buffers window)
				     (window-next-buffers window)))))
		  (set-window-info (window info)
		    (set-window-buffer window (car info))
		    (set-window-prev-buffers window (cadr info))
		    (set-window-next-buffers window (cddr info))))
	(when-let* ((this-info (window-info (selected-window)))
		    (next-info (window-info (next-window)))
		    (width (frame-width))
		    (this-edges (window-edges (selected-window)))
		    (next-edges (window-edges (next-window))))
	  (when (or (and (< width split-width-threshold)
			 (/= (car this-edges) (car next-edges)))
		    (and (>= width split-width-threshold)
			 (/= (cadr this-edges) (cadr next-edges))))
	    ;; Ensure we start with a fresh window.
	    (split-window)
	    (other-window 1)
	    (delete-other-windows)

	    (if (and (<= (car this-edges) (car next-edges))
		     (<= (cadr this-edges) (cadr next-edges)))
		;; Want to use `pop-to-buffer' for the second window s.t. my
		;; rule for REPLs in `display-buffer-alist' takes effect.
		(progn (set-window-info (selected-window) this-info)
		       (save-selected-window
			 (pop-to-buffer (car next-info))
			 (set-window-info (selected-window) next-info)))
	      (set-window-info (selected-window) next-info)
	      (pop-to-buffer (car this-info))
	      (set-window-info (selected-window) this-info))))))))
--8<---------------cut here---------------end--------------->8---

For completeness, though I doubt it is relevant, packages (installed
from Debian) are:

elpa-bongo
elpa-dash
elpa-debian-el
elpa-dpkg-dev-el
elpa-esxml
elpa-ggtags
elpa-git-annex
elpa-git-commit
elpa-git-modes
elpa-gitattributes-mode
elpa-gitconfig-mode
elpa-gitignore-mode
elpa-haskell-tab-indent
elpa-htmlize
elpa-ledger
elpa-magit
elpa-magit-section
elpa-mailscripts
elpa-markdown-mode
elpa-message-templ
elpa-notmuch
elpa-nov
elpa-org
elpa-org-contrib
elpa-org-d20
elpa-orgalist
elpa-paredit
elpa-pod-mode
elpa-rainbow-mode
elpa-s
elpa-seq
elpa-taxy
elpa-volume
elpa-with-editor
elpa-ws-butler
elpa-yasnippet
elpa-yasnippet-snippets

-- 
Sean Whitton