diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c index 030bb67c22d..4f01d9ce024 100644 --- a/dlls/dxgi/swapchain.c +++ b/dlls/dxgi/swapchain.c @@ -385,18 +385,18 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreen swapchain_desc.windowed = !fullscreen; hr = wined3d_swapchain_set_fullscreen(swapchain->wined3d_swapchain, &swapchain_desc, NULL); wined3d_mutex_unlock(); - - if (SUCCEEDED(hr)) + if (FAILED(hr)) { - if (swapchain->target) - IDXGIOutput_Release(swapchain->target); - swapchain->target = target; - return S_OK; + if (target) + IDXGIOutput_Release(target); + return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE; } - if (target) - IDXGIOutput_Release(target); - return hr; + if (swapchain->target) + IDXGIOutput_Release(swapchain->target); + swapchain->target = target; + + return S_OK; } static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetFullscreenState(IDXGISwapChain1 *iface,