[PATCH 1/4] wined3d: Set color / depth / stencil surfaces to NULL before releasing them in IWineD3DDeviceImpl_Uninit3D().
Henri Verbeet
hverbeet at codeweavers.com
Fri Jan 28 13:05:40 CST 2011
---
dlls/wined3d/device.c | 41 ++++++++++++++++++++++-------------------
1 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 676eafc..d5ae431 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2112,6 +2112,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
const struct wined3d_gl_info *gl_info;
+ struct IWineD3DSurfaceImpl *surface;
struct wined3d_context *context;
int sampler;
UINT i;
@@ -2200,44 +2201,46 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
/* Release the buffers (with sanity checks)*/
if (This->onscreen_depth_stencil)
{
- IWineD3DSurface_Release((IWineD3DSurface *)This->onscreen_depth_stencil);
+ surface = This->onscreen_depth_stencil;
This->onscreen_depth_stencil = NULL;
+ IWineD3DSurface_Release((IWineD3DSurface *)surface);
}
if (This->depth_stencil)
{
- IWineD3DSurfaceImpl *ds = This->depth_stencil;
+ surface = This->depth_stencil;
- TRACE("Releasing depth/stencil buffer %p.\n", ds);
+ TRACE("Releasing depth/stencil buffer %p.\n", surface);
This->depth_stencil = NULL;
- if (IWineD3DSurface_Release((IWineD3DSurface *)ds)
- && ds != This->auto_depth_stencil)
+ if (IWineD3DSurface_Release((IWineD3DSurface *)surface)
+ && surface != This->auto_depth_stencil)
{
- ERR("Something is still holding a reference to depth/stencil buffer %p.\n", ds);
+ ERR("Something is still holding a reference to depth/stencil buffer %p.\n", surface);
}
}
- for (i = 1; i < gl_info->limits.buffers; ++i)
- {
- IWineD3DDevice_SetRenderTarget(iface, i, NULL, FALSE);
- }
-
- TRACE("Releasing the render target at %p\n", This->render_targets[0]);
- IWineD3DSurface_Release((IWineD3DSurface *)This->render_targets[0]);
-
- TRACE("Setting rendertarget to NULL\n");
- This->render_targets[0] = NULL;
-
if (This->auto_depth_stencil)
{
- if (IWineD3DSurface_Release((IWineD3DSurface *)This->auto_depth_stencil))
+ surface = This->auto_depth_stencil;
+ This->auto_depth_stencil = NULL;
+ if (IWineD3DSurface_Release((IWineD3DSurface *)surface))
{
FIXME("(%p) Something's still holding the auto depth stencil buffer\n", This);
}
- This->auto_depth_stencil = NULL;
}
+ for (i = 1; i < gl_info->limits.buffers; ++i)
+ {
+ IWineD3DDevice_SetRenderTarget(iface, i, NULL, FALSE);
+ }
+
+ surface = This->render_targets[0];
+ TRACE("Setting rendertarget 0 to NULL\n");
+ This->render_targets[0] = NULL;
+ TRACE("Releasing the render target at %p\n", surface);
+ IWineD3DSurface_Release((IWineD3DSurface *)surface);
+
context_release(context);
for (i = 0; i < This->NumberOfSwapChains; ++i)
--
1.7.3.4
More information about the wine-patches
mailing list