Subject: Re: bug#32850: 27.0.50; window-swap-states doesn't swap window prev/next-buffers

From: Juri Linkov <[email-masked]>
Date: Sun, 28 Oct 2018 21:09:15 +0200

>> @@ -5552,9 +5552,14 @@ window--state-get-1
>>   	 (buffer (window-buffer window))
>>   	 (selected (eq window (selected-window)))
>>   	 (next-buffers (when (window-live-p window)
>> -			 (window-next-buffers window)))
>> +	                 (delq nil (mapcar (lambda (buffer)
>> +                                             (and (buffer-live-p buffer) buffer))
>> +                                           (window-next-buffers window)))))
>>   	 (prev-buffers (when (window-live-p window)
>> -			 (window-prev-buffers window)))
>> +	                 (delq nil (mapcar (lambda (entry)
>> +                                             (and (buffer-live-p (nth 0 entry))
>> +                                                  entry))
>> +                                           (window-prev-buffers window)))))
>>   	 (head
>>   	  `(,type
>>               ,@(unless (window-next-sibling window) `((last . t)))
>
> OK.  Wouldn't 'window-state-put' run into a similar problem when a
> buffer in some prev or next list gets killed in between getting and
> putting?

'window-state-put' already checks for 'buffer-live-p', and checking for nil
is not needed in 'window-state-put' after the patch above will protect
against nil getting into the window state.