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

e3ca576576 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.
This commit is contained in:
Henri Verbeet 2009-10-27 10:10:42 +01:00 committed by Alexandre Julliard
parent 13c4fe72ad
commit 94509f85b5
1 changed files with 16 additions and 13 deletions

View File

@ -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
*