Ulrich Czekalla : ddraw: IDirectDraw3 should use its own ref count variable .

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 18 05:34:27 CST 2006


Module: wine
Branch: master
Commit: 325f666fc57eda037935ecada14191bbec6002a0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=325f666fc57eda037935ecada14191bbec6002a0

Author: Ulrich Czekalla <ulrich.czekalla at utoronto.ca>
Date:   Fri Dec 15 11:15:28 2006 -0500

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 26c1bc8..d31d280 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 99518f0..ce61f18 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 a520381..26aac5d 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)));
             }




More information about the wine-cvs mailing list