From f912e55610d055464680d8d05f60f54a4a8174f2 Mon Sep 17 00:00:00 2001
From: Adam Martinson <amartinson@codeweavers.com>
Date: Fri, 29 Apr 2011 16:48:25 -0500
Subject: [PATCH] wined3d: Fix an oops/crash in context_destroy_gl_resources().

Introduced by 96b150929b0791c7c30ade49d55cedf2d608537e.
---
 dlls/wined3d/context.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 00a649bffce..9fecddd26cf 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -989,7 +989,10 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
 
         if (gl_info->supported[ARB_SYNC])
         {
-            if (event_query->object.sync) GL_EXTCALL(glDeleteSync(event_query->object.sync));
+            for (i = 0; i < context->free_event_query_count; ++i)
+            {
+                GL_EXTCALL(glDeleteSync(context->free_event_queries[i].sync));
+            }
         }
         else if (gl_info->supported[APPLE_FENCE])
         {
-- 
GitLab