Commit 94509f85 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Restore the wglMakeCurrent() call in context_destroy_gl_resources().

e3ca5765 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.
parent 13c4fe72
......@@ -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
*
......
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