Henri Verbeet : wined3d: Release the context before potentially destroying the swapchain in wined3d_device_uninit_3d () (Valgrind).

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 27 07:45:10 CDT 2015


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Apr 24 19:31:38 2015 +0200

wined3d: Release the context before potentially destroying the swapchain in wined3d_device_uninit_3d() (Valgrind).

---

 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);




More information about the wine-cvs mailing list