Subject: Re: bug#63312: 29.0.90; set-frame-parameter sometimes called with dead frame when quitting ediff

From: Po Lu <[email-masked]>
Date: Sat, 06 May 2023 19:12:51 +0800

Eli Zaretskii <[email-masked]> writes:

>> Date: Sat, 6 May 2023 12:10:33 +0200
>> Cc: [email-masked]
>> From: Tobias Bading <[email-masked]>
>> 
>> > Does the patch below give good results?
>> >
>> > diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
>> > index 9286a18..acfbbed 100644
>> > --- a/lisp/x-dnd.el
>> > +++ b/lisp/x-dnd.el
>> > @@ -609,8 +609,9 @@ x-dnd-init-xdnd-for-frame
>> >  (defun x-dnd-after-move-frame (frame)
>> >    "Handle FRAME moving to a different position.
>> >  Clear any cached root window position."
>> > -  (set-frame-parameter frame 'dnd-root-window-position
>> > -                       nil))
>> > +  (and (frame-live-p frame)
>> > +       (set-frame-parameter frame 'dnd-root-window-position
>> > +                            nil)))
>> >
>> >  (add-hook 'move-frame-functions #'x-dnd-after-move-frame)
>> 
>> It probably would, because for testing purposes I already patched
>> handle-move-frame like this:
>
> Not really, because there could be other functions on the hook
> variable, which do deal well with a dead frame.
>
> Po Lu, any objections to installing my proposed change?

Please install on emacs-29, thanks.  This hook should not be called with
a dead frame though, and Martin proposed a fix for that which was
installed last year, so I will continue to investigate on master.