[PATCH 4/5] wined3d: Use context->valid in context_destroy_gl_resources().

Henri Verbeet hverbeet at codeweavers.com
Tue Oct 20 04:05:05 CDT 2009


Instead of relying on wglMakeCurrent() to do what we want.
---
 dlls/wined3d/context.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 16304ee..a96dea4 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -633,22 +633,19 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
     struct wined3d_occlusion_query *occlusion_query;
     struct wined3d_event_query *event_query;
     struct fbo_entry *entry, *entry2;
-    BOOL has_glctx;
-
-    has_glctx = pwglMakeCurrent(context->hdc, context->glCtx);
-    if (!has_glctx) WARN("Failed to activate context. Window already destroyed?\n");
 
     ENTER_GL();
 
     LIST_FOR_EACH_ENTRY(occlusion_query, &context->occlusion_queries, struct wined3d_occlusion_query, entry)
     {
-        if (has_glctx && GL_SUPPORT(ARB_OCCLUSION_QUERY)) GL_EXTCALL(glDeleteQueriesARB(1, &occlusion_query->id));
+        if (context->valid && GL_SUPPORT(ARB_OCCLUSION_QUERY))
+            GL_EXTCALL(glDeleteQueriesARB(1, &occlusion_query->id));
         occlusion_query->context = NULL;
     }
 
     LIST_FOR_EACH_ENTRY(event_query, &context->event_queries, struct wined3d_event_query, entry)
     {
-        if (has_glctx)
+        if (context->valid)
         {
             if (GL_SUPPORT(APPLE_FENCE)) GL_EXTCALL(glDeleteFencesAPPLE(1, &event_query->id));
             else if (GL_SUPPORT(NV_FENCE)) GL_EXTCALL(glDeleteFencesNV(1, &event_query->id));
@@ -656,11 +653,13 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
         event_query->context = NULL;
     }
 
-    LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &context->fbo_list, struct fbo_entry, entry) {
-        if (!has_glctx) entry->id = 0;
+    LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &context->fbo_list, struct fbo_entry, entry)
+    {
+        if (!context->valid) entry->id = 0;
         context_destroy_fbo_entry(context, entry);
     }
-    if (has_glctx)
+
+    if (context->valid)
     {
         if (context->src_fbo)
         {
-- 
1.6.4.4




More information about the wine-patches mailing list