[PATCH] wined3d: Avoid crash in swapchain_gl_present() if context could not be acquired.

Paul Gofman gofmanp at gmail.com
Wed Nov 13 09:15:15 CST 2019


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 dlls/wined3d/swapchain.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 62bab65fcf..e4ffce8965 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -453,7 +453,12 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
     struct wined3d_context *context;
     BOOL render_to_fbo;
 
-    context = context_acquire(swapchain->device, swapchain->front_buffer, 0);
+    if (!(context = context_acquire(swapchain->device, swapchain->front_buffer, 0)))
+    {
+        WARN("Could not get context, skipping present.\n");
+        return;
+    }
+
     context_gl = wined3d_context_gl(context);
     if (!context_gl->valid)
     {
-- 
2.23.0




More information about the wine-devel mailing list