[1/9] DDraw: Make IDirectDrawImpl thread safe

Alexandre Julliard julliard at winehq.org
Tue Aug 22 04:50:14 CDT 2006


Stefan Dösinger <stefandoesinger at gmx.at> writes:

> @@ -245,11 +252,12 @@ void
>  IDirectDrawImpl_Destroy(IDirectDrawImpl *This)
>  {
>      IDirectDrawImpl *prev;
> +    DDOBJ_LOCK(This);

You shouldn't need locking in Destroy, if the refcount is zero no one
else can be using the object.

>          for(prev = ddraw_list; prev; prev = prev->next)
> +        {
>              if(prev->next == This) break;
> +        }
>  
>          if(prev)
> +        {
> +            DDOBJ_LOCK(prev);
>              prev->next = This->next;
> +            DDOBJ_UNLOCK(prev);
> +        }

You can't lock just one object, you have the protect the whole list.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list