1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

Stop multifont fallback from crashing in GTK1.

I was tacitly assuming that mfont->fallback would always be non-NULL,
which is true in a world containing Pango, but untrue in GTK1 when
Pango isn't there. In that situation we fall back to just omitting the
characters that would be displayed in the fallback font, on the
grounds that that's better than dereferencing through a NULL vtable.
This commit is contained in:
Simon Tatham 2015-08-15 20:26:07 +01:00
parent f3f215423b
commit 0f60287f66

View File

@ -1631,6 +1631,7 @@ static void multifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font,
int wide, int bold, int cellwidth) int wide, int bold, int cellwidth)
{ {
struct multifont *mfont = (struct multifont *)font; struct multifont *mfont = (struct multifont *)font;
unifont *f;
int ok, i; int ok, i;
while (len > 0) { while (len > 0) {
@ -1647,8 +1648,10 @@ static void multifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font,
/* /*
* Now display it. * Now display it.
*/ */
unifont_draw_text(target, gc, ok ? mfont->main : mfont->fallback, f = ok ? mfont->main : mfont->fallback;
x, y, string, i, wide, bold, cellwidth); if (f)
unifont_draw_text(target, gc, f, x, y, string, i, wide, bold,
cellwidth);
string += i; string += i;
len -= i; len -= i;
x += i * cellwidth; x += i * cellwidth;