From 7ebf3d92b578d70b4073c8d365aea5cfdafb1447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 14 Aug 2007 14:44:41 +0200 Subject: [PATCH] wined3d: Release the stateblock before destroying the swapchain. --- dlls/wined3d/device.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index bdc2c948726..43d801f3365 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1975,6 +1975,25 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D IWineD3DDevice_SetTexture(iface, WINED3DVERTEXTEXTURESAMPLER0 + sampler, NULL); } + /* Release the update stateblock */ + if(IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock) > 0){ + if(This->updateStateBlock != This->stateBlock) + FIXME("(%p) Something's still holding the Update stateblock\n",This); + } + This->updateStateBlock = NULL; + + { /* because were not doing proper internal refcounts releasing the primary state block + causes recursion with the extra checks in ResourceReleased, to avoid this we have + to set this->stateBlock = NULL; first */ + IWineD3DStateBlock *stateBlock = (IWineD3DStateBlock *)This->stateBlock; + This->stateBlock = NULL; + + /* Release the stateblock */ + if(IWineD3DStateBlock_Release(stateBlock) > 0){ + FIXME("(%p) Something's still holding the Update stateblock\n",This); + } + } + /* 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)){ @@ -2008,25 +2027,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D This->swapchains = NULL; This->NumberOfSwapChains = 0; - /* Release the update stateblock */ - if(IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock) > 0){ - if(This->updateStateBlock != This->stateBlock) - FIXME("(%p) Something's still holding the Update stateblock\n",This); - } - This->updateStateBlock = NULL; - - { /* because were not doing proper internal refcounts releasing the primary state block - causes recursion with the extra checks in ResourceReleased, to avoid this we have - to set this->stateBlock = NULL; first */ - IWineD3DStateBlock *stateBlock = (IWineD3DStateBlock *)This->stateBlock; - This->stateBlock = NULL; - - /* Release the stateblock */ - if(IWineD3DStateBlock_Release(stateBlock) > 0){ - FIXME("(%p) Something's still holding the Update stateblock\n",This); - } - } - HeapFree(GetProcessHeap(), 0, This->render_targets); HeapFree(GetProcessHeap(), 0, This->fbo_color_attachments); HeapFree(GetProcessHeap(), 0, This->draw_buffers);