Stefan Dösinger <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]


Reply via email to