`persp-delete-frame` alters windows of other frames when killing frame with dedicated window
When closing a frame that only contains one dedicated window, messages similar to the following get logged in *Messages*:
Error during redisplay: (run-hook-with-args persp-delete-frame #<dead frame testing 0x8d099f8>) signaled (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
Error during redisplay: (run-hook-with-args persp-delete-frame #<dead frame testing 0x8d099f8>) signaled (error "#<window 467> is not a live window") [225 times]
This also seems to coincide with either a window getting removed from another frame, or the window being changed to some other buffer if it's the only window on the frame.
I've been able to reproduce this in Emacs 28.2. I first noticed it in an EXWM environment (since EXWM creates a new frame with a dedicated window for "floating" X windows), but I've been able to reproduce it in a regular Emacs environment as well.
Steps to reproduce:
- Open a new frame (
C-x 5 2) - Open a new buffer in that frame's window (
C-x b <some buffer name>) - Set the window in that frame to be dedicated
M-: (set-window-dedicated-p (selected-window) t) - Delete the frame (
C-x 5 0) - Note the changes in other open frames, and the errors logged in
*Messages*.
Suspected cause The infinite loop appears to be as follows:
-
persp-delete-frame->persp-kill -
persp-kill->persp-remove-buffer -
persp-remove-buffer->kill-bufferif the buffer doesn't exist in other perspectives -
kill-buffer->replace-buffer-in-windows -
replace-buffer-in-windows->delete-framesince the window is dedicated, and the only window in the frame -
delete-framerunsdelete-frame-functions, which containspersp-delete-frame
Thank you for the detailed bug report. I'm swamped right now, but will try to find time to take a look in the next couple of weeks.