]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Stop multifont fallback from crashing in GTK1.
authorSimon Tatham <anakin@pobox.com>
Sat, 15 Aug 2015 19:26:07 +0000 (20:26 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 15 Aug 2015 19:51:44 +0000 (20:51 +0100)
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.

unix/gtkfont.c

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