Subject: bug#31373: 26.1; frame-list-z-order segfaults on initial daemon frame

From: Noam Postavsky <[email-masked]>
Date: Sun, 06 May 2018 13:09:33 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: Noam Postavsky <[email-masked]>
>> Date: Sun, 06 May 2018 12:28:16 -0400
>> 
>> >> +	    if (XFRAME (frame)->output_method == output_x_window
>> 
>> Also, I noticed that there is FRAME_X_P for this.  I can't find any more
>> obvious instances of missing this check, although it's hard to tell in
>> many cases if the frame is really guaranteed to have output_x_window has
>> the output_method.
>
> Don't we usually signal an error in such cases?  Through
> check_x_display_info or somesuch?

Fx_frame_list_z_order already has a check_x_display_info call, but the
FRAME_X_P check is needed when looping over all the frames, like in
xic_create_xfontset and x_make_monitor_attribute_list.

Perhaps a FOR_EACH_FRAME_IN_TERMINAL macro would be less error-prone?