Commit 1ee1f2e9 authored by Esme Povirk's avatar Esme Povirk Committed by Alexandre Julliard

gdiplus: Fix crash in GdipAddPathString.

Apparently, 1454ffe7 introduced the assumption that the font passed to gdip_format_string is non-NULL, and GdipAddPathString wasn't passing it in.
parent ebaa47dc
...@@ -1141,7 +1141,6 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT ...@@ -1141,7 +1141,6 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
} }
get_log_fontW(font, graphics, &lfw); get_log_fontW(font, graphics, &lfw);
GdipDeleteFont(font);
GdipDeleteGraphics(graphics); GdipDeleteGraphics(graphics);
hfont = CreateFontIndirectW(&lfw); hfont = CreateFontIndirectW(&lfw);
...@@ -1150,6 +1149,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT ...@@ -1150,6 +1149,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
WARN("Failed to create font\n"); WARN("Failed to create font\n");
DeleteDC(dc); DeleteDC(dc);
GdipDeletePath(backup); GdipDeletePath(backup);
GdipDeleteFont(font);
return GenericError; return GenericError;
} }
...@@ -1161,11 +1161,12 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT ...@@ -1161,11 +1161,12 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
args.maxY = 0; args.maxY = 0;
args.scale = emSize / native_height; args.scale = emSize / native_height;
args.ascent = textmetric.tmAscent * args.scale; 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); format, TRUE, format_string_callback, &args);
DeleteDC(dc); DeleteDC(dc);
DeleteObject(hfont); DeleteObject(hfont);
GdipDeleteFont(font);
if (status != Ok) /* free backup */ if (status != Ok) /* free backup */
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment