Bug 2107144

Summary: xblast-x11 crashes with "BadFont (invalid Font parameter)" after usig xblast-sdl
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: xblastAssignee: Hans de Goede <hdegoede>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: hdegoede
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: xblast-2.10.4-35.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-16 15:55:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Pisar 2022-07-14 12:43:13 UTC
If you start xblast-x11 after using xblast-sdl, xblast-x11 crashed on start like this:

$ xblast-x11 
could not load font 24
could not load font 18
could not load font 14
X Error of failed request:  BadFont (invalid Font parameter)
  Major opcode of failed request:  56 (X_ChangeGC)
  Resource id in failed request:  0x0
  Serial number of failed request:  501
  Current serial number in output stream:  524

The reason is that xblast-sdl stores into ~/.xblast_tnt/config/x11.cfg:

[font]
large=24
medium=18
small=14

and then xblast-x11 reuses that font settings and passes the numbers to XLoadQueryFont() in LoadFont() in x11c_text.c. That obviously fails because X11 does not expect a font size number "24", but na X11 font pattern "-*-helvetica-bold-r-*-*-24-*-*-*-*-*-iso8859-*" as defined in defaultFontConfig array.

Affected package is xblast-x11-2.10.4-34.fc36.x86_64.
The easiest way to reproduce it is to delete ~/.xblast_tnt before starting the two programs.

I believe that a proper fix is separating the two font configurations. One for X11 and another for SDL.

Comment 1 Hans de Goede 2022-07-16 15:55:13 UTC
> I believe that a proper fix is separating the two font configurations. One for X11 and another for SDL.

Right. Thank you for reporting this and thank you for the analysis of the problem.

I've just prepared an update (for rawhide only since normal users are unlike to hit this) which:

1. Changes the SDL build to use ~/.xblast_tnt/config/sdl.cfg as config file for the font settings
2. Changes the X11 config loading code to recognize the broken settings and have it fallback to the defaults in that case