Subject: bug#66151: 29.1.50; daemon crashing after X forwarding disconnects

From: Eli Zaretskii <[email-masked]>
Date: Fri, 19 Apr 2024 14:15:39 +0300

> From: Po Lu <[email-masked]>
> Cc: George P <[email-masked]>,  [email-masked]
> Date: Fri, 19 Apr 2024 17:07:19 +0800
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Po Lu, how should we go about making some progress here?
> 
> Thanks.  My hands are quite full and will remain so into the next week,
> but if this crude attempt to sidestep the crash works, it should suffice
> until I establish why dead frames are still being retained in
> Vfontset_table.  George?
> 
> diff --git a/src/fontset.c b/src/fontset.c
> index d27fa22015e..d969e5f1180 100644
> --- a/src/fontset.c
> +++ b/src/fontset.c
> @@ -1366,10 +1366,11 @@ free_realized_fontsets (Lisp_Object base)
>        if (CHAR_TABLE_P (this) && EQ (FONTSET_BASE (this), base))
>  	{
>  	  Fclear_face_cache (Qt);
> -	  /* This is in case some Lisp calls this function and then
> -	     proceeds with calling some other function, like font-at,
> -	     which needs the basic faces.  */
> -	  recompute_basic_faces (XFRAME (FONTSET_FRAME (this)));
> +	  if (!FRAME_LIVE_P (XFRAME (FONTSET_FRAME (this))))
> +	    /* This is in case some Lisp calls this function and then
> +	       proceeds with calling some other function, like font-at,
> +	       which needs the basic faces.  */
> +	    recompute_basic_faces (XFRAME (FONTSET_FRAME (this)));
>  	  break;
>  	}
>      }

Are you sure it should be !FRAME_LIVE_P ?  Why would we condition the
call to recompute_basic_faces on the fact that the relevant frame is
no longer alive?  What am I missing?