|
From: Steven G. J. <st...@gi...> - 2000-08-24 08:00:07
|
Vis5d 5.2 contains a bunch of code like:
if (XLoadFont(...))
...do stuff with font...
Apparently, this code was written assuming that XLoadFont returns 0 if
there is an error loading the font. It doesn't. Rather, if the font
isn't available, it simply crashes with a BadName error.
In particular, this causes Vis5d to crash on systems (e.g. SuSE Linux) for
which DEFAULT_SOUNDFONTNAME ("6x12") is not available, even if you never
open the sounding window. (Thanks to Michael Tung for reporting this.)
The proper thing to do is to use XLoadQueryFont, which returns NULL if the
font can't be found, in which case you can recover gracefully. This is
what the below patch does. In addition, it switches to the more-common
"fixed" font if "6x12" is not available, and cleans up a couple of memory
leaks from FontStruct pointers not being freed.
This will be incorporated into a Vis5d+ 1.0.1 release
(vis5d.sourceforge.net), available in the next day or two. I hope that it
will also be included in the mainline tree.
Cordially,
Steven G. Johnson
PS. Would people rather I didn't send these patches to the main Vis5d
list? I could send them directly to Bill Hibbard instead, and/or to the
"vis5d-devel" list I've set up on the SourceForge site (if he wants to
subscribe to that).
|