wined3d: Make sure we release the correct DC in context_update_window().
This commit is contained in:
parent
ac95c302ff
commit
82e39ced7f
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue