Commit addd8e69 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Fix cache entry use-after-free (Valgrind).

parent d06443d6
......@@ -198,6 +198,7 @@ extern void factory_release_cached_fontface(struct fontfacecached*) DECLSPEC_HID
extern void get_logfont_from_font(IDWriteFont*,LOGFONTW*) DECLSPEC_HIDDEN;
extern void get_logfont_from_fontface(IDWriteFontFace*,LOGFONTW*) DECLSPEC_HIDDEN;
extern HRESULT create_gdiinterop(IDWriteFactory5*,IDWriteGdiInterop1**) DECLSPEC_HIDDEN;
extern void fontface_detach_from_cache(IDWriteFontFace4*) DECLSPEC_HIDDEN;
/* Opentype font table functions */
struct dwrite_font_props {
......
......@@ -443,6 +443,12 @@ static void release_fontfamily_data(struct dwrite_fontfamily_data *data)
heap_free(data);
}
void fontface_detach_from_cache(IDWriteFontFace4 *iface)
{
struct dwrite_fontface *fontface = impl_from_IDWriteFontFace4(iface);
fontface->cached = NULL;
}
static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace4 *iface, REFIID riid, void **obj)
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface);
......
......@@ -566,6 +566,7 @@ static void release_fontface_cache(struct list *fontfaces)
LIST_FOR_EACH_ENTRY_SAFE(fontface, fontface2, fontfaces, struct fontfacecached, entry) {
list_remove(&fontface->entry);
fontface_detach_from_cache(fontface->fontface);
heap_free(fontface);
}
}
......
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