diff --git a/dlls/avifil32/acmstream.c b/dlls/avifil32/acmstream.c index 2f1874449a..f44a77b0b4 100644 --- a/dlls/avifil32/acmstream.c +++ b/dlls/avifil32/acmstream.c @@ -160,10 +160,11 @@ static ULONG WINAPI ACMStream_fnAddRef(IAVIStream *iface) static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface) { IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p) -> %ld\n", iface, This->ref - 1); + TRACE("(%p) -> %ld\n", iface, ref); - if (This->ref == 0) { + if (ref == 0) { /* destruct */ if (This->has != NULL) { if (This->acmStreamHdr.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) @@ -202,7 +203,7 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface) if (This->pStream != NULL) IAVIStream_Release(This->pStream); - return --This->ref; + return ref; } /* lParam1: PAVISTREAM diff --git a/dlls/avifil32/icmstream.c b/dlls/avifil32/icmstream.c index 7091f13e23..838a087960 100644 --- a/dlls/avifil32/icmstream.c +++ b/dlls/avifil32/icmstream.c @@ -176,10 +176,11 @@ static ULONG WINAPI ICMStream_fnAddRef(IAVIStream *iface) static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface) { IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p) -> %ld\n", iface, This->ref - 1); + TRACE("(%p) -> %ld\n", iface, ref); - if (This->ref == 0) { + if (ref == 0) { /* destruct */ if (This->pg != NULL) { AVIStreamGetFrameClose(This->pg); @@ -224,7 +225,7 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface) if (This->pStream != NULL) IAVIStream_Release(This->pStream); - return --This->ref; + return ref; } /* lParam1: PAVISTREAM