Commit 438d115e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Correct reference count behavior for font face interface.

parent c503af85
...@@ -352,6 +352,7 @@ static ULONG WINAPI dwritefont_Release(IDWriteFont *iface) ...@@ -352,6 +352,7 @@ static ULONG WINAPI dwritefont_Release(IDWriteFont *iface)
if (!ref) if (!ref)
{ {
if (This->face) IDWriteFontFace_Release(This->face);
IDWriteFontFamily_Release(This->family); IDWriteFontFamily_Release(This->family);
heap_free(This); heap_free(This);
} }
...@@ -442,8 +443,6 @@ static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont *iface, IDWriteFontF ...@@ -442,8 +443,6 @@ static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont *iface, IDWriteFontF
{ {
HRESULT hr = create_fontface(&This->face); HRESULT hr = create_fontface(&This->face);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
*face = This->face;
return hr;
} }
*face = This->face; *face = This->face;
......
...@@ -433,17 +433,17 @@ if (0) /* crashes on native */ ...@@ -433,17 +433,17 @@ if (0) /* crashes on native */
hr = IDWriteFont_CreateFontFace(font, &fontface); hr = IDWriteFont_CreateFontFace(font, &fontface);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
EXPECT_REF(font, 1); EXPECT_REF(font, 1);
EXPECT_REF(fontface, 1); EXPECT_REF(fontface, 2);
hr = IDWriteFont_CreateFontFace(font, &fontface2); hr = IDWriteFont_CreateFontFace(font, &fontface2);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(fontface == fontface2, "got %p, was %p\n", fontface2, fontface); ok(fontface == fontface2, "got %p, was %p\n", fontface2, fontface);
EXPECT_REF(fontface, 2); EXPECT_REF(fontface, 3);
EXPECT_REF(font, 1); EXPECT_REF(font, 1);
IDWriteFontFace_AddRef(fontface); IDWriteFontFace_AddRef(fontface);
EXPECT_REF(font, 1); EXPECT_REF(font, 1);
EXPECT_REF(fontface, 3); EXPECT_REF(fontface, 4);
IDWriteFontFace_Release(fontface); IDWriteFontFace_Release(fontface);
IDWriteFontFace_Release(fontface); IDWriteFontFace_Release(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