[PATCH 4/5] wined3d: Release the context before potentially destroying the swapchain in wined3d_device_uninit_3d() (Valgrind).

Henri Verbeet hverbeet at codeweavers.com
Fri Apr 24 12:31:38 CDT 2015


---
 dlls/wined3d/device.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 4954d00..0822f61 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1086,6 +1086,12 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
     device->shader_backend->shader_free_private(device);
     destroy_dummy_textures(device, gl_info);
 
+    /* Release the context again as soon as possible. In particular,
+     * releasing the render target views below may release the last reference
+     * to the swapchain associated with this context, which in turn will
+     * destroy the context. */
+    context_release(context);
+
     /* Release the buffers (with sanity checks)*/
     if (device->onscreen_depth_stencil)
     {
@@ -1123,8 +1129,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
         device->back_buffer_view = NULL;
     }
 
-    context_release(context);
-
     for (i = 0; i < device->swapchain_count; ++i)
     {
         TRACE("Releasing the implicit swapchain %u.\n", i);
-- 
1.7.10.4




More information about the wine-patches mailing list