[PATCH v2] quartz: Change reference increasing method to avoid unintended DLL unloading.

Zebediah Figura (she/her) zfigura at codeweavers.com
Thu Aug 19 11:04:11 CDT 2021


On 8/19/21 5:11 AM, Hiroki Awata wrote:
> diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c
> index b3210fdcd59..249867da8c8 100644
> --- a/dlls/quartz/filtermapper.c
> +++ b/dlls/quartz/filtermapper.c
> @@ -195,6 +195,7 @@ static HRESULT enum_reg_filters_create(REGFILTER *filters, unsigned int count, I
>       object->refcount = 1;
>       object->count = count;
>   
> +    InterlockedIncrement(&object_locks);
>       TRACE("Created enumerator %p.\n", object);
>       *out = &object->IEnumRegFilters_iface;
>       return S_OK;
> @@ -329,6 +330,7 @@ static HRESULT enum_moniker_create(IMoniker **filters, unsigned int count, IEnum
>       object->refcount = 1;
>       object->count = count;
>   
> +    InterlockedIncrement(&object_locks);
>       TRACE("Created enumerator %p.\n", object);
>       *out = &object->IEnumMoniker_iface;
>       return S_OK;

These two are desirable, but it needs a corresponding decrement in the 
Release() methods. It should probably also be a separate patch.

> diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
> index cc13f776cfb..1bc4d1d0041 100644
> --- a/dlls/quartz/memallocator.c
> +++ b/dlls/quartz/memallocator.c
> @@ -936,5 +936,6 @@ HRESULT mem_allocator_create(IUnknown *lpUnkOuter, IUnknown **out)
>       else
>           CoTaskMemFree(pMemAlloc);
>   
> +    InterlockedIncrement(&object_locks);
>       return hr;
>   }

This increases object_locks in the failure case.

video_renderer_create() also needs an increment; it seems to have been 
overlooked by this patch.



More information about the wine-devel mailing list