the test for 0.
- Use Interlocked* functions in Stream_fnRelease .
- Store the result of the Interlocked functions and this in the
TRACE.
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)
if (This->pStream != NULL)
IAVIStream_Release(This->pStream);
- return --This->ref;
+ return ref;
}
/* lParam1: PAVISTREAM
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);
if (This->pStream != NULL)
IAVIStream_Release(This->pStream);
- return --This->ref;
+ return ref;
}
/* lParam1: PAVISTREAM