From 49da19e51ba5623a5e169a59fe3de1414b80ebba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 11 Jun 2018 12:05:06 +0200 Subject: [PATCH] wined3d: Execute all CS commands before changing swapchain window. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a race condition. Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/swapchain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 7a3f1ff95e9..9df40abc70c 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -135,6 +135,8 @@ void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapch void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window) { + struct wined3d_device *device = swapchain->device; + if (!window) window = swapchain->device_window; if (window == swapchain->win_handle) @@ -142,6 +144,9 @@ void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWN TRACE("Setting swapchain %p window from %p to %p.\n", swapchain, swapchain->win_handle, window); + + device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT); + swapchain->win_handle = window; }