ddraw: Use ddraw_surface_release_iface to destroy leftover surfaces.
This commit is contained in:
parent
7521ae4291
commit
c7e5e6d2b5
|
@ -212,6 +212,7 @@ HRESULT ddraw_surface_create_texture(IDirectDrawSurfaceImpl *surface) DECLSPEC_H
|
||||||
void ddraw_surface_destroy(IDirectDrawSurfaceImpl *surface) DECLSPEC_HIDDEN;
|
void ddraw_surface_destroy(IDirectDrawSurfaceImpl *surface) DECLSPEC_HIDDEN;
|
||||||
HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw,
|
HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw,
|
||||||
DDSURFACEDESC2 *desc, UINT mip_level, WINED3DSURFTYPE surface_type, UINT version) DECLSPEC_HIDDEN;
|
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)
|
static inline IDirectDrawSurfaceImpl *surface_from_texture1(IDirect3DTexture *iface)
|
||||||
{
|
{
|
||||||
|
|
|
@ -752,7 +752,7 @@ DestroyCallback(IDirectDrawSurface7 *surf,
|
||||||
void *context)
|
void *context)
|
||||||
{
|
{
|
||||||
IDirectDrawSurfaceImpl *Impl = impl_from_IDirectDrawSurface7(surf);
|
IDirectDrawSurfaceImpl *Impl = impl_from_IDirectDrawSurface7(surf);
|
||||||
ULONG ref, ref3, ref2;
|
ULONG ref, ref3, ref2, iface_count;
|
||||||
|
|
||||||
ref = IDirectDrawSurface7_Release(surf); /* For the EnumSurfaces */
|
ref = IDirectDrawSurface7_Release(surf); /* For the EnumSurfaces */
|
||||||
IDirectDrawSurface3_AddRef(&Impl->IDirectDrawSurface3_iface);
|
IDirectDrawSurface3_AddRef(&Impl->IDirectDrawSurface3_iface);
|
||||||
|
@ -769,9 +769,8 @@ DestroyCallback(IDirectDrawSurface7 *surf,
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
|
|
||||||
/* Destroy the surface */
|
/* Destroy the surface */
|
||||||
while (ref) ref = IDirectDrawSurface7_Release(surf);
|
iface_count = ddraw_surface_release_iface(Impl);
|
||||||
while (ref3) ref3 = IDirectDrawSurface3_Release(&Impl->IDirectDrawSurface3_iface);
|
while (iface_count) iface_count = ddraw_surface_release_iface(Impl);
|
||||||
while (ref2) ref2 = IDirectDrawSurface2_Release(&Impl->IDirectDrawSurface2_iface);
|
|
||||||
|
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -449,7 +449,7 @@ static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface)
|
||||||
IUnknown_Release(ifaceToRelease);
|
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);
|
ULONG iface_count = InterlockedDecrement(&This->iface_count);
|
||||||
TRACE("%p decreasing iface count to %u.\n", 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);
|
WARN("(%p) Attempt to destroy a surface that is not a complex root\n", This);
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
return;
|
return iface_count;
|
||||||
}
|
}
|
||||||
if (This->wined3d_texture) /* If it's a texture, destroy the wined3d texture. */
|
if (This->wined3d_texture) /* If it's a texture, destroy the wined3d texture. */
|
||||||
wined3d_texture_decref(This->wined3d_texture);
|
wined3d_texture_decref(This->wined3d_texture);
|
||||||
|
@ -471,7 +471,7 @@ static void ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This)
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return iface_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue