ddraw: IDirectDraw3 should use its own ref count variable.

This commit is contained in:
Ulrich Czekalla 2006-12-15 11:15:28 -05:00 committed by Alexandre Julliard
parent f26cb44c73
commit 325f666fc5
3 changed files with 8 additions and 6 deletions

View File

@ -96,7 +96,7 @@ struct IDirectDrawImpl
ICOM_VFIELD_MULTI(IDirect3D);
/* See comment in IDirectDraw::AddRef */
LONG ref7, ref4, ref2, ref1, numIfaces;
LONG ref7, ref4, ref2, ref3, ref1, numIfaces;
/* WineD3D linkage */
IWineD3D *wineD3D;

View File

@ -110,9 +110,9 @@ static ULONG WINAPI
IDirectDraw3Impl_AddRef(LPDIRECTDRAW3 iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
ULONG ref = InterlockedIncrement(&This->ref4);
ULONG ref = InterlockedIncrement(&This->ref3);
TRACE("(%p) : incrementing IDirectDraw4 refcount from %u.\n", This, ref -1);
TRACE("(%p) : incrementing IDirectDraw3 refcount from %u.\n", This, ref -1);
if(ref == 1) InterlockedIncrement(&This->numIfaces);
@ -170,9 +170,9 @@ static ULONG WINAPI
IDirectDraw3Impl_Release(LPDIRECTDRAW3 iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
ULONG ref = InterlockedDecrement(&This->ref4);
ULONG ref = InterlockedDecrement(&This->ref3);
TRACE_(ddraw)("(%p)->() decrementing IDirectDraw4 refcount from %u.\n", This, ref +1);
TRACE_(ddraw)("(%p)->() decrementing IDirectDraw3 refcount from %u.\n", This, ref +1);
if(ref == 0)
{

View File

@ -882,11 +882,12 @@ DllMain(HINSTANCE hInstDLL,
int i;
IDirectDrawImpl *ddraw = LIST_ENTRY(entry, IDirectDrawImpl, ddraw_list_entry);
WARN("DDraw %p has a refcount of %d\n", ddraw, ddraw->ref7 + ddraw->ref4 + ddraw->ref2 + ddraw->ref1);
WARN("DDraw %p has a refcount of %d\n", ddraw, ddraw->ref7 + ddraw->ref4 + ddraw->ref3 + ddraw->ref2 + ddraw->ref1);
/* Add references to each interface to avoid freeing them unexpectadely */
IDirectDraw_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw));
IDirectDraw2_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw2));
IDirectDraw3_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw3));
IDirectDraw4_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw4));
IDirectDraw7_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw7));
@ -925,6 +926,7 @@ DllMain(HINSTANCE hInstDLL,
*/
while(IDirectDraw_Release(ICOM_INTERFACE(ddraw, IDirectDraw)));
while(IDirectDraw2_Release(ICOM_INTERFACE(ddraw, IDirectDraw2)));
while(IDirectDraw3_Release(ICOM_INTERFACE(ddraw, IDirectDraw3)));
while(IDirectDraw4_Release(ICOM_INTERFACE(ddraw, IDirectDraw4)));
while(IDirectDraw7_Release(ICOM_INTERFACE(ddraw, IDirectDraw7)));
}