dwrite: Fix cache entry use-after-free (Valgrind).
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d06443d659
commit
addd8e69ff
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue