dwrite: Always initialize context and font table pointers.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-04-01 08:40:07 +03:00 committed by Alexandre Julliard
parent 5cf42c0c97
commit 7cac7bb99f
2 changed files with 12 additions and 0 deletions

View File

@ -967,6 +967,9 @@ HRESULT opentype_get_font_table(IDWriteFontFileStream *stream, DWRITE_FONT_FACE_
if (found) *found = FALSE; if (found) *found = FALSE;
if (table_size) *table_size = 0; if (table_size) *table_size = 0;
*table_data = NULL;
*table_context = NULL;
if (type == DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION) { if (type == DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION) {
const TTC_Header_V1 *ttc_header; const TTC_Header_V1 *ttc_header;
void * ttc_context; void * ttc_context;

View File

@ -2923,6 +2923,15 @@ static void test_TryGetFontTable(void)
IDWriteFontFace_ReleaseFontTable(fontface, context2); IDWriteFontFace_ReleaseFontTable(fontface, context2);
IDWriteFontFace_ReleaseFontTable(fontface, context); IDWriteFontFace_ReleaseFontTable(fontface, context);
/* table does not exist */
exists = TRUE;
context = (void*)0xdeadbeef;
table = (void*)0xdeadbeef;
hr = IDWriteFontFace_TryGetFontTable(fontface, 0xabababab, &table, &size, &context, &exists);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(exists == FALSE, "got %d\n", exists);
ok(context == NULL && table == NULL, "got context %p, table pointer %p\n", context, table);
IDWriteFontFace_Release(fontface); IDWriteFontFace_Release(fontface);
IDWriteFontFile_Release(file); IDWriteFontFile_Release(file);
IDWriteFactory_Release(factory); IDWriteFactory_Release(factory);