From 05b16589d0f658e929eaafb416d4b19bd88bb47d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 28 Aug 2014 16:09:45 +0200
Subject: wined3d: Move FBO destruction into the worker thread.

This protects the context array against races.
---
 dlls/wined3d/device.c   | 2 --
 dlls/wined3d/resource.c | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 62b0625..b5ce2c3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4638,8 +4638,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
 
     TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type));
 
-    context_resource_released(device, resource, type);
-
     switch (type)
     {
         case WINED3D_RTYPE_SURFACE:
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 8069160..cd60356 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -159,6 +159,8 @@ void wined3d_resource_free_bo(struct wined3d_resource *resource)
 
 void wined3d_resource_cleanup_cs(struct wined3d_resource *resource)
 {
+    context_resource_released(resource->device, resource, resource->type);
+
     if (resource->buffer)
         wined3d_resource_free_bo(resource);
 
-- 
2.1.3

