From: Elizabeth Figura <zfigura(a)codeweavers.com> Fixes: 6bfd4eb5ec48581479235bd99a88adab91a2aee2 --- dlls/dxcore/dxcore.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dlls/dxcore/dxcore.c b/dlls/dxcore/dxcore.c index 9aa28f8a3a0..6d475030258 100644 --- a/dlls/dxcore/dxcore.c +++ b/dlls/dxcore/dxcore.c @@ -27,6 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dxcore); +static struct dxcore_adapter_factory *dxcore_adapter_factory; + struct dxcore_adapter { IDXCoreAdapter IDXCoreAdapter_iface; @@ -378,7 +380,10 @@ static ULONG STDMETHODCALLTYPE dxcore_adapter_factory_Release(IDXCoreAdapterFact TRACE("%p decreasing refcount to %lu.\n", iface, refcount); if (!refcount) + { free(factory); + dxcore_adapter_factory = NULL; + } return refcount; } @@ -506,25 +511,23 @@ static const struct IDXCoreAdapterFactoryVtbl dxcore_adapter_factory_vtbl = HRESULT STDMETHODCALLTYPE DXCoreCreateAdapterFactory(REFIID riid, void **out) { - static struct dxcore_adapter_factory *factory = NULL; - TRACE("riid %s, out %p\n", debugstr_guid(riid), out); if (!out) return E_POINTER; - if (!factory) + if (!dxcore_adapter_factory) { - if (!(factory = calloc(1, sizeof(*factory)))) + if (!(dxcore_adapter_factory = calloc(1, sizeof(*dxcore_adapter_factory)))) { *out = NULL; return E_OUTOFMEMORY; } - factory->IDXCoreAdapterFactory_iface.lpVtbl = &dxcore_adapter_factory_vtbl; - factory->refcount = 0; + dxcore_adapter_factory->IDXCoreAdapterFactory_iface.lpVtbl = &dxcore_adapter_factory_vtbl; + dxcore_adapter_factory->refcount = 0; } TRACE("created IDXCoreAdapterFactory %p.\n", *out); - return IDXCoreAdapterFactory_QueryInterface(&factory->IDXCoreAdapterFactory_iface, riid, out); + return IDXCoreAdapterFactory_QueryInterface(&dxcore_adapter_factory->IDXCoreAdapterFactory_iface, riid, out); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8729