ddraw: Use ddraw_surface_release_iface to destroy leftover surfaces.

This commit is contained in:
Ričardas Barkauskas 2011-06-28 01:06:16 +03:00 committed by Alexandre Julliard
parent 7521ae4291
commit c7e5e6d2b5
3 changed files with 7 additions and 7 deletions

View File

@ -212,6 +212,7 @@ HRESULT ddraw_surface_create_texture(IDirectDrawSurfaceImpl *surface) DECLSPEC_H
void ddraw_surface_destroy(IDirectDrawSurfaceImpl *surface) DECLSPEC_HIDDEN;
HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw,
DDSURFACEDESC2 *desc, UINT mip_level, WINED3DSURFTYPE surface_type, UINT version) DECLSPEC_HIDDEN;
ULONG ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This) DECLSPEC_HIDDEN;
static inline IDirectDrawSurfaceImpl *surface_from_texture1(IDirect3DTexture *iface)
{

View File

@ -752,7 +752,7 @@ DestroyCallback(IDirectDrawSurface7 *surf,
void *context)
{
IDirectDrawSurfaceImpl *Impl = impl_from_IDirectDrawSurface7(surf);
ULONG ref, ref3, ref2;
ULONG ref, ref3, ref2, iface_count;
ref = IDirectDrawSurface7_Release(surf); /* For the EnumSurfaces */
IDirectDrawSurface3_AddRef(&Impl->IDirectDrawSurface3_iface);
@ -769,9 +769,8 @@ DestroyCallback(IDirectDrawSurface7 *surf,
return DDENUMRET_OK;
/* Destroy the surface */
while (ref) ref = IDirectDrawSurface7_Release(surf);
while (ref3) ref3 = IDirectDrawSurface3_Release(&Impl->IDirectDrawSurface3_iface);
while (ref2) ref2 = IDirectDrawSurface2_Release(&Impl->IDirectDrawSurface2_iface);
iface_count = ddraw_surface_release_iface(Impl);
while (iface_count) iface_count = ddraw_surface_release_iface(Impl);
return DDENUMRET_OK;
}

View File

@ -449,7 +449,7 @@ static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface)
IUnknown_Release(ifaceToRelease);
}
static void ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This)
ULONG ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This)
{
ULONG iface_count = InterlockedDecrement(&This->iface_count);
TRACE("%p decreasing iface count to %u.\n", This, iface_count);
@ -462,7 +462,7 @@ static void ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This)
{
WARN("(%p) Attempt to destroy a surface that is not a complex root\n", This);
LeaveCriticalSection(&ddraw_cs);
return;
return iface_count;
}
if (This->wined3d_texture) /* If it's a texture, destroy the wined3d texture. */
wined3d_texture_decref(This->wined3d_texture);
@ -471,7 +471,7 @@ static void ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This)
LeaveCriticalSection(&ddraw_cs);
}
return;
return iface_count;
}
/*****************************************************************************