Module: wine Branch: master Commit: 6129e92e9903c65d72ec3f34f96d9aa4af779b32 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6129e92e9903c65d72ec3f34f9...
Author: H. Verbeet hverbeet@gmail.com Date: Thu Jul 10 23:26:10 2008 +0200
wined3d: Destroy the shader backend after the stateblock.
Destroying the stateblock potentially references the shader backend. If the stateblock has active shaders when it is released, the shader's destructor will tell the shader backend to destroy the corresponding resources. This was exposed by my patch that moved the glsl program lookup table into the backend's private data.
---
dlls/wined3d/device.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d25e1bc..998f950 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2197,7 +2197,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR return WINED3D_OK;
err_out: - This->shader_backend->shader_free_private(iface); HeapFree(GetProcessHeap(), 0, This->render_targets); HeapFree(GetProcessHeap(), 0, This->fbo_color_attachments); HeapFree(GetProcessHeap(), 0, This->draw_buffers); @@ -2216,6 +2215,7 @@ err_out: IWineD3DStateBlock_Release((IWineD3DStateBlock *) This->stateBlock); This->stateBlock = NULL; } + This->shader_backend->shader_free_private(iface); return hr; }
@@ -2283,7 +2283,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D This->depth_blt_rb_w = 0; This->depth_blt_rb_h = 0; } - This->shader_backend->shader_free_private(iface);
/* Release the update stateblock */ if(IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock) > 0){ @@ -2304,6 +2303,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D } }
+ /* Destroy the shader backend. Note that this has to happen after all shaders are destroyed. */ + This->shader_backend->shader_free_private(iface); + /* Release the buffers (with sanity checks)*/ TRACE("Releasing the depth stencil buffer at %p\n", This->stencilBufferTarget); if(This->stencilBufferTarget != NULL && (IWineD3DSurface_Release(This->stencilBufferTarget) >0)){