ChangeSet ID: 16234 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@wine.codeweavers.com 2005/02/22 08:51:03 Modified files: dlls/mapi32 : prop.c Log message: Jon Griffiths Fix race in IMAPIProp_Release(), -W fixes. Patch: http://cvs.winehq.org/patch.py?id=16234 Old revision New revision Changes Path 1.7 1.8 +10 -7 wine/dlls/mapi32/prop.c Index: wine/dlls/mapi32/prop.c diff -u -p wine/dlls/mapi32/prop.c:1.7 wine/dlls/mapi32/prop.c:1.8 --- wine/dlls/mapi32/prop.c:1.7 Sun May 19 12:24:34 2013 +++ wine/dlls/mapi32/prop.c Sun May 19 12:24:34 2013 @@ -795,7 +795,8 @@ SCODE WINAPI ScCopyProps(int cValues, LP { LPSPropValue lpDest = (LPSPropValue)lpDst; char *lpDataDest = (char *)(lpDest + cValues); - ULONG ulLen, i, iter; + ULONG ulLen, i; + int iter; TRACE("(%d,%p,%p,%p)\n", cValues, lpProps, lpDst, lpCount); @@ -930,7 +931,8 @@ SCODE WINAPI ScRelocProps(int cValues, L static const BOOL bBadPtr = TRUE; /* Windows bug - Assumes source is bad */ LPSPropValue lpDest = (LPSPropValue)lpProps; ULONG ulCount = cValues * sizeof(SPropValue); - ULONG ulLen, i, iter; + ULONG ulLen, i; + int iter; TRACE("(%d,%p,%p,%p,%p)\n", cValues, lpProps, lpOld, lpNew, lpCount); @@ -1520,7 +1522,7 @@ static inline ULONG WINAPI IMAPIProp_fnA { IPropDataImpl *This = (IPropDataImpl*)iface; - TRACE("(%p)->(count=%ld)\n", This, This->lRef); + TRACE("(%p)->(count before=%lu)\n", This, This->lRef); return InterlockedIncrement(&This->lRef); } @@ -1534,10 +1536,12 @@ static inline ULONG WINAPI IMAPIProp_fnA static inline ULONG WINAPI IMAPIProp_fnRelease(LPMAPIPROP iface) { IPropDataImpl *This = (IPropDataImpl*)iface; + LONG lRef; - TRACE("(%p)->()\n", This); + TRACE("(%p)->(count before=%lu)\n", This, This->lRef); - if (!InterlockedDecrement(&This->lRef)) + lRef = InterlockedDecrement(&This->lRef); + if (!lRef) { TRACE("Destroying IPropData (%p)\n",This); @@ -1552,9 +1556,8 @@ static inline ULONG WINAPI IMAPIProp_fnR } RtlDeleteCriticalSection(&This->cs); This->lpFree(This); - return 0U; } - return (ULONG)This->lRef; + return (ULONG)lRef; } /**************************************************************************