Module: wine Branch: master Commit: 94509f85b563e20ba9be791522f58b1a22a160cc URL: http://source.winehq.org/git/wine.git/?a=commit;h=94509f85b563e20ba9be791522...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Oct 27 10:10:42 2009 +0100
wined3d: Restore the wglMakeCurrent() call in context_destroy_gl_resources().
e3ca576576c46131330353f45990f55045cf7541 removed this call because we don't need it to tell if the context is valid, but we still need it to actually make the context current.
---
dlls/wined3d/context.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index d4fb7fd..2cbac67 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -641,6 +641,18 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource } }
+static void context_validate(struct wined3d_context *context) +{ + HWND wnd = WindowFromDC(context->hdc); + + if (wnd != context->win_handle) + { + WARN("DC %p belongs to window %p instead of %p.\n", + context->hdc, wnd, context->win_handle); + context->valid = 0; + } +} + static void context_destroy_gl_resources(struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -648,6 +660,9 @@ static void context_destroy_gl_resources(struct wined3d_context *context) struct wined3d_event_query *event_query; struct fbo_entry *entry, *entry2;
+ context_validate(context); + if (context->valid) pwglMakeCurrent(context->hdc, context->glCtx); + ENTER_GL();
LIST_FOR_EACH_ENTRY(occlusion_query, &context->occlusion_queries, struct wined3d_occlusion_query, entry) @@ -712,7 +727,7 @@ static void context_destroy_gl_resources(struct wined3d_context *context) HeapFree(GetProcessHeap(), 0, context->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, context->free_event_queries);
- if (!pwglMakeCurrent(NULL, NULL)) + if (pwglGetCurrentContext() && !pwglMakeCurrent(NULL, NULL)) { ERR("Failed to disable GL context.\n"); } @@ -801,18 +816,6 @@ BOOL context_set_current(struct wined3d_context *ctx) return TlsSetValue(wined3d_context_tls_idx, ctx); }
-static void context_validate(struct wined3d_context *context) -{ - HWND wnd = WindowFromDC(context->hdc); - - if (wnd != context->win_handle) - { - WARN("DC %p belongs to window %p instead of %p.\n", - context->hdc, wnd, context->win_handle); - context->valid = 0; - } -} - /***************************************************************************** * Context_MarkStateDirty *