From 325f666fc57eda037935ecada14191bbec6002a0 Mon Sep 17 00:00:00 2001 From: Ulrich Czekalla Date: Fri, 15 Dec 2006 11:15:28 -0500 Subject: [PATCH] ddraw: IDirectDraw3 should use its own ref count variable. --- dlls/ddraw/ddraw_private.h | 2 +- dlls/ddraw/ddraw_thunks.c | 8 ++++---- dlls/ddraw/main.c | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 26c1bc83bcd..d31d2805dec 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -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; diff --git a/dlls/ddraw/ddraw_thunks.c b/dlls/ddraw/ddraw_thunks.c index 99518f01dcf..ce61f18528d 100644 --- a/dlls/ddraw/ddraw_thunks.c +++ b/dlls/ddraw/ddraw_thunks.c @@ -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) { diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index a520381c32a..26aac5d69d6 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -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))); }