Henri Verbeet : wined3d: Unload resources on Uninit3D().

Alexandre Julliard julliard at winehq.org
Mon Mar 23 12:34:51 CDT 2009


Module: wine
Branch: master
Commit: 24a4503d6133de126c4e34911baf3b79d81e0bd7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=24a4503d6133de126c4e34911baf3b79d81e0bd7

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Mar 23 13:54:34 2009 +0100

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 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7f1840f..a64083c 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;




More information about the wine-cvs mailing list