[v3 PATCH 1/2] dwrite: Protect cached fontface list when accessed from multiple threads
Anton Romanov
theli.ua at gmail.com
Thu Aug 10 11:43:06 CDT 2017
> --- snip ---
> if (!ref)
> {
> EnterCriticalSection(...);
> list_remove(...);
> LeaveCriticalSection(...);
>
> ...
> }
> --- snip ---
>
> And when querying cached font faces:
>
> --- snip ---
> EnterCriticalSection(...);
> LIST_FOR_EACH_ENTRY(...)
> {
> ...
>
> /* the following code could also be hidden in QueryInterface */
> if (InterlockedIncrement( &obj->refcount ) == 1)
> {
> InterlockedDecrement( &obj->refcount );
> continue;
> }
>
> /* return it */
> }
> LeaveCriticalSection(...);
> --- snip ---
Doesn't the object just leak in this scenario though ? (assuming
current refcount is 1) :
============= ===========
Thread A Thread B
============= ===========
enter_cs
Increment
Decrement
ref != Zero
Decrement
leave_cs
============= ===========
More information about the wine-devel
mailing list