From 24a4503d6133de126c4e34911baf3b79d81e0bd7 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 23 Mar 2009 13:54:34 +0100 Subject: [PATCH] wined3d: Unload resources on Uninit3D(). This should prevent destroying GL objects without a GL context. Eg. when a ddraw surface has a GL texture and is released after a call to Uninit3D(). --- dlls/wined3d/device.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 7f1840f4ddd..a64083cf9f8 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2568,6 +2568,13 @@ err_out: return hr; } +static HRESULT WINAPI device_unload_resource(IWineD3DResource *resource, void *ctx) +{ + IWineD3DResource_UnLoad(resource); + IWineD3DResource_Release(resource); + return WINED3D_OK; +} + static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_DESTROYSURFACEFN D3DCB_DestroyDepthStencilSurface, D3DCB_DESTROYSWAPCHAINFN D3DCB_DestroySwapChain) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; int sampler; @@ -2583,6 +2590,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D if(This->logo_surface) IWineD3DSurface_Release(This->logo_surface); + /* Unload resources */ + IWineD3DDevice_EnumResources(iface, device_unload_resource, NULL); + TRACE("Deleting high order patches\n"); for(i = 0; i < PATCHMAP_SIZE; i++) { struct list *e1, *e2;