When "MS Shell Dlg" is missing GdipCreateFontFamilyFromName() leaves the GpFontFamily* pointer uninitialised. So initialize it to NULL in order to get clean failures instead of a crash.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- We used to just get a failure, probably because that pointer happened to be NULL. But that changed on August 23: https://test.winehq.org/data/patterns.html#gdiplus:font
The next question is "why do we get a failure in the first place?". That's the subject of bug 51685: https://bugs.winehq.org/show_bug.cgi?id=51685
Finally there are other calls to GdipCreateFontFamilyFromName() but they either check for failure or try to load Tahoma which is a built-in Wine font. So it did not feel necessary to check for failures everywhere. --- dlls/gdiplus/tests/font.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 4ffa9e823fc..031e4688c6c 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -883,8 +883,10 @@ static void test_font_substitution(void) ok(lstrcmpA(lf.lfFaceName, "MS Shell Dlg") != 0, "expected substitution of MS Shell Dlg\n"); GdipDeleteFont(font);
+ family = NULL; status = GdipCreateFontFamilyFromName(L"MS Shell Dlg", NULL, &family); expect(Ok, status); + font = NULL; status = GdipCreateFont(family, 12, FontStyleRegular, UnitPoint, &font); expect(Ok, status); memset(&lf, 0xfe, sizeof(lf));