dxgi: Fix possible null output from d3d11_swapchain_GetFullscreenState.
When swapchain is created in windowed mode, and then enter fullscreen via Alt+Enter. Calling d3d11_swapchain_GetFullscreenState will return a null output because swapchain->target wasn't initialized. Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
facd7cce6d
commit
e66f8e8c2d
|
@ -407,23 +407,35 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetFullscreenState(IDXGISwapCha
|
||||||
{
|
{
|
||||||
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
|
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
|
||||||
struct wined3d_swapchain_desc swapchain_desc;
|
struct wined3d_swapchain_desc swapchain_desc;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, fullscreen %p, target %p.\n", iface, fullscreen, target);
|
TRACE("iface %p, fullscreen %p, target %p.\n", iface, fullscreen, target);
|
||||||
|
|
||||||
if (fullscreen)
|
if (fullscreen || target)
|
||||||
{
|
{
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
|
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
*fullscreen = !swapchain_desc.windowed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fullscreen)
|
||||||
|
*fullscreen = !swapchain_desc.windowed;
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
|
if (!swapchain_desc.windowed)
|
||||||
|
{
|
||||||
|
if (!swapchain->target && FAILED(hr = IDXGISwapChain1_GetContainingOutput(iface, &swapchain->target)))
|
||||||
|
return hr;
|
||||||
|
|
||||||
*target = swapchain->target;
|
*target = swapchain->target;
|
||||||
if (*target)
|
|
||||||
IDXGIOutput_AddRef(*target);
|
IDXGIOutput_AddRef(*target);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*target = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5456,7 +5456,7 @@ static void test_window_association(void)
|
||||||
ok(fullscreen == tests[i].expect_fullscreen
|
ok(fullscreen == tests[i].expect_fullscreen
|
||||||
|| broken(tests[i].broken_d3d10 && fullscreen),
|
|| broken(tests[i].broken_d3d10 && fullscreen),
|
||||||
"Test %u: Got unexpected fullscreen %#x.\n", i, fullscreen);
|
"Test %u: Got unexpected fullscreen %#x.\n", i, fullscreen);
|
||||||
todo_wine_if(fullscreen) ok(fullscreen ? !!output : !output, "Test %u: Got wrong output.\n", i);
|
ok(fullscreen ? !!output : !output, "Test %u: Got wrong output.\n", i);
|
||||||
if (output)
|
if (output)
|
||||||
IDXGIOutput_Release(output);
|
IDXGIOutput_Release(output);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue