1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

gdiplus: Fix crash in GdipAddPathString.

Apparently, 1454ffe7dd introduced
the assumption that the font passed to gdip_format_string is
non-NULL, and GdipAddPathString wasn't passing it in.
This commit is contained in:
Esme Povirk 2024-02-28 16:40:50 +00:00 committed by Alexandre Julliard
parent ebaa47dcee
commit 1ee1f2e9d7

View file

@ -1141,7 +1141,6 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
}
get_log_fontW(font, graphics, &lfw);
GdipDeleteFont(font);
GdipDeleteGraphics(graphics);
hfont = CreateFontIndirectW(&lfw);
@ -1150,6 +1149,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
WARN("Failed to create font\n");
DeleteDC(dc);
GdipDeletePath(backup);
GdipDeleteFont(font);
return GenericError;
}
@ -1161,11 +1161,12 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
args.maxY = 0;
args.scale = emSize / native_height;
args.ascent = textmetric.tmAscent * args.scale;
status = gdip_format_string(graphics, dc, string, length, NULL, &scaled_layout_rect,
status = gdip_format_string(graphics, dc, string, length, font, &scaled_layout_rect,
format, TRUE, format_string_callback, &args);
DeleteDC(dc);
DeleteObject(hfont);
GdipDeleteFont(font);
if (status != Ok) /* free backup */
{