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

dwrite: Use safer method to set per-factory EUDC collection reference.

parent db999065
...@@ -1272,10 +1272,20 @@ static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory5 *ifac ...@@ -1272,10 +1272,20 @@ static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory5 *ifac
if (This->eudc_collection) if (This->eudc_collection)
IDWriteFontCollection1_AddRef(This->eudc_collection); IDWriteFontCollection1_AddRef(This->eudc_collection);
else else {
hr = get_eudc_fontcollection(iface, &This->eudc_collection); IDWriteFontCollection1 *eudc_collection;
if (FAILED(hr = get_eudc_fontcollection(iface, &eudc_collection))) {
*collection = NULL;
WARN("Failed to get EUDC collection, hr %#x.\n", hr);
return hr;
}
*collection = (IDWriteFontCollection*)This->eudc_collection; if (InterlockedCompareExchangePointer((void **)&This->eudc_collection, eudc_collection, NULL))
IDWriteFontCollection1_Release(eudc_collection);
}
*collection = (IDWriteFontCollection *)This->eudc_collection;
return hr; return hr;
} }
...@@ -1801,8 +1811,7 @@ void factory_detach_fontcollection(IDWriteFactory5 *iface, IDWriteFontCollection ...@@ -1801,8 +1811,7 @@ void factory_detach_fontcollection(IDWriteFactory5 *iface, IDWriteFontCollection
{ {
struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); struct dwritefactory *factory = impl_from_IDWriteFactory5(iface);
InterlockedCompareExchangePointer((void **)&factory->system_collection, NULL, collection); InterlockedCompareExchangePointer((void **)&factory->system_collection, NULL, collection);
if (factory->eudc_collection == collection) InterlockedCompareExchangePointer((void **)&factory->eudc_collection, NULL, collection);
factory->eudc_collection = NULL;
IDWriteFactory5_Release(iface); IDWriteFactory5_Release(iface);
} }
......
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