Module: wine
Branch: master
Commit: 03ca2b2932b38e0b79592787e32013c1e5ae66bd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=03ca2b2932b38e0b79592787e…
Author: Ken Thomases <ken(a)codeweavers.com>
Date: Sun Mar 23 22:45:44 2014 -0500
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 56673c7..73e2c39 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)))
{