Module: wine
Branch: master
Commit: cdc9aadf5c9144920caefcfe7a0e12915ee0ce38
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cdc9aadf5c9144920caefcfe7…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Sun Oct 16 21:55:30 2011 +0200
wined3d: Don't try to access the swapchain of a destroyed context in context_set_gl_context().
---
dlls/wined3d/context.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 3353434..ef8b94e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -768,6 +768,17 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx)
ctx->valid = 0;
WARN("Trying fallback to the backup window.\n");
+ /* FIXME: If the context is destroyed it's no longer associated with
+ * a swapchain, so we can't use the swapchain to get a backup dc. To
+ * make this work windowless contexts would need to be handled by the
+ * device. */
+ if (ctx->destroyed)
+ {
+ FIXME("Unable to get backup dc for destroyed context %p.\n", ctx);
+ context_set_current(NULL);
+ return FALSE;
+ }
+
if (!(dc = swapchain_get_backup_dc(swapchain)))
{
context_set_current(NULL);