Ričardas Barkauskas : ddraw: Do not AddRef IDirectDraw7 iface in CreateSurface helper.

Alexandre Julliard julliard at winehq.org
Mon Aug 22 13:29:13 CDT 2011


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

Author: Ričardas Barkauskas <rbarkauskas at codeweavers.com>
Date:   Mon Aug  8 01:26:08 2011 +0300

ddraw: Do not AddRef IDirectDraw7 iface in CreateSurface helper.

---

 dlls/ddraw/ddraw.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index daea1ca..fc0dd93 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -3471,10 +3471,6 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
         ddraw_create_gdi_swapchain(ddraw, object);
     }
 
-    /* Addref the ddraw interface to keep an reference for each surface */
-    IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface);
-    object->ifaceToRelease = (IUnknown *)&ddraw->IDirectDraw7_iface;
-
     /* Create a WineD3DTexture if a texture was requested */
     if (desc2.ddsCaps.dwCaps & DDSCAPS_TEXTURE)
     {
@@ -3523,6 +3519,8 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *
     }
 
     *surface = &impl->IDirectDrawSurface7_iface;
+    IDirectDraw7_AddRef(iface);
+    impl->ifaceToRelease = (IUnknown *)iface;
 
     return hr;
 }
@@ -3563,7 +3561,6 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
     }
 
     *surface = &impl->IDirectDrawSurface4_iface;
-    IDirectDraw7_Release(&This->IDirectDraw7_iface);
     IDirectDraw4_AddRef(iface);
     impl->ifaceToRelease = (IUnknown *)iface;
 
@@ -3606,7 +3603,6 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, DDSURFACEDESC *s
     }
 
     *surface = &impl->IDirectDrawSurface_iface;
-    IDirectDraw7_Release(&This->IDirectDraw7_iface);
     IDirectDraw3_AddRef(iface);
     impl->ifaceToRelease = (IUnknown *)iface;
 
@@ -3649,7 +3645,6 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
     }
 
     *surface = &impl->IDirectDrawSurface_iface;
-    IDirectDraw7_Release(&This->IDirectDraw7_iface);
     impl->ifaceToRelease = NULL;
 
     return hr;
@@ -3682,7 +3677,6 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
     }
 
     *surface = &impl->IDirectDrawSurface_iface;
-    IDirectDraw7_Release(&This->IDirectDraw7_iface);
     impl->ifaceToRelease = NULL;
 
     return hr;




More information about the wine-cvs mailing list