branch: elpa/hl-block-mode
commit dce1394f220fdaceac3946ff3ef0dce48178ea13
Author: Campbell Barton <[email protected]>
Commit: Campbell Barton <[email protected]>
Style: add frame-live-p check in timer callback
Add defensive check to ensure frames are still live before
iterating over their windows. Frames could theoretically be
deleted between getting the list and iterating.
---
hl-block-mode.el | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/hl-block-mode.el b/hl-block-mode.el
index 221be9bd0d4..29501bca773 100644
--- a/hl-block-mode.el
+++ b/hl-block-mode.el
@@ -341,15 +341,16 @@ Argument BLOCK-LIST represents start-end ranges of
braces."
(when hl-block--dirty-flush-all
;; Run the mode callback for all other buffers in the queue.
(dolist (frame (frame-list))
- (dolist (win (window-list frame -1))
- (let ((buf (window-buffer win)))
- (when (and (buffer-local-value 'hl-block-mode buf)
- (buffer-local-value 'hl-block--dirty buf))
- (with-selected-frame frame
- (with-selected-window win
- (with-current-buffer buf
- (setq hl-block--dirty nil)
- (hl-block--overlay-refresh)))))))))
+ (when (frame-live-p frame)
+ (dolist (win (window-list frame -1))
+ (let ((buf (window-buffer win)))
+ (when (and (buffer-local-value 'hl-block-mode buf)
+ (buffer-local-value 'hl-block--dirty buf))
+ (with-selected-frame frame
+ (with-selected-window win
+ (with-current-buffer buf
+ (setq hl-block--dirty nil)
+ (hl-block--overlay-refresh))))))))))
;; Always keep the current buffer dirty
;; so navigating away from this buffer will refresh it.
(when is-mode-active