Commit 82e39ced authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Make sure we release the correct DC in context_update_window().

parent ac95c302
......@@ -873,7 +873,18 @@ static void context_update_window(struct wined3d_context *context)
if (context->valid)
{
if (!ReleaseDC(context->win_handle, context->hdc))
/* You'd figure ReleaseDC() would fail if the DC doesn't match the
* window. However, that's not what actually happens, and there are
* user32 tests that confirm ReleaseDC() with the wrong window is
* supposed to succeed. So explicitly check that the DC belongs to
* the window, since we want to avoid releasing a DC that belongs to
* some other window if the original window was already destroyed. */
if (WindowFromDC(context->hdc) != context->win_handle)
{
WARN("DC %p does not belong to window %p.\n",
context->hdc, context->win_handle);
}
else if (!ReleaseDC(context->win_handle, context->hdc))
{
ERR("Failed to release device context %p, last error %#x.\n",
context->hdc, GetLastError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment