DDraw: Split up the ddraw refcount

Alexandre Julliard julliard at winehq.org
Fri Jul 7 13:28:07 CDT 2006


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

> +    if(ref == 0) InterlockedDecrement(&This->numIfaces);
>  
> -        /* This is for the dll cleanup code in DllMain() */
> -        if(!This->DoNotDestroy)
> -            IDirectDrawImpl_Destroy(This);
> -    }
> +    /* Checks the refcount before actually destroying the object */
> +    IDirectDrawImpl_Destroy(This);

This isn't thread safe, you should only call Destroy when the
InterlockedDecrement returns 0, otherwise there's no point in using
interlocked functions at all. Also you should get rid of the
DoNotDestroy flag and use the refcount for that.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list