[AVIFIL32] question about ACMStream_fn[AddRef|Release] in acmstream.c

Paul Vriens Paul.Vriens at xs4all.nl
Tue Jan 11 10:18:34 CST 2005


Hi,

during my code cleanup I came to acmstream.c and found the following:

static ULONG WINAPI ACMStream_fnAddRef(IAVIStream *iface)
{
  IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
                                                                                                         
  TRACE("(%p) -> %ld\n", iface, This->ref + 1);
                                                                                                         
  /* also add reference to the nested stream */
  if (This->pStream != NULL)
    IAVIStream_AddRef(This->pStream);
                                                                                                         
  return ++(This->ref);
}

the AddRef can be cleaned up.
                             
the Release however looks buggy:
 
static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
{
  IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
                                                                                                         
  TRACE("(%p) -> %ld\n", iface, This->ref - 1);
                                                                                                         
  if (This->ref == 0) {
    /* destruct */


This means I have to do a Release twice before it actually goes into the
if statement, because the decrementing takes place at the end of the
Release function.

Can anybody confirm my finding.

Cheers,

Paul.




More information about the wine-devel mailing list