From 0f21b13a057d684fa30678d8c08e87614eca066a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 20:09:55 +0200
Subject: wined3d: Wait for the cs to finish before destroying the device

---
 dlls/wined3d/device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 05a353c..9ef99b2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1013,6 +1013,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
     if (!device->d3d_initialized)
         return WINED3DERR_INVALIDCALL;
 
+    if (wined3d_settings.cs_multithreaded)
+        device->cs->ops->finish(device->cs);
+
     /* I don't think that the interface guarantees that the device is destroyed from the same thread
      * it was created. Thus make sure a context is active for the glDelete* calls
      */
-- 
2.1.3

