From 03ca2b2932b38e0b79592787e32013c1e5ae66bd Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Sun, 23 Mar 2014 22:45:44 -0500 Subject: [PATCH] wined3d: Don't leak the HDC of an invalid context in context_update_window(). If context_set_gl_context() fails, it marks the context as invalid. It still has an HDC, though, and context_update_window() would lose the reference to it. --- dlls/wined3d/context.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 56673c7e93d..73e2c39813e 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -884,13 +884,12 @@ static void context_update_window(struct wined3d_context *context) TRACE("Updating context %p window from %p to %p.\n", context, context->win_handle, context->swapchain->win_handle); - if (context->valid) + if (context->hdc) wined3d_release_dc(context->win_handle, context->hdc); - else - context->valid = 1; context->win_handle = context->swapchain->win_handle; context->needs_set = 1; + context->valid = 1; if (!(context->hdc = GetDC(context->win_handle))) {