[PATCH] winex11.drv: Check if the surface is in list in wine_vk_surface_release().

Paul Gofman pgofman at codeweavers.com
Tue Nov 9 08:43:31 CST 2021


Fixes a regression introduced by
6dcaff421f87a93efe18b2efe0ec64d94ed1d483.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
    The surface might have not been added to the list
    if it gets released from error path in X11DRV_vkCreateWin32SurfaceKHR().

 dlls/winex11.drv/vulkan.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 4f6624b3db8..6f67d9a8a19 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -211,9 +211,12 @@ static void wine_vk_surface_release(struct wine_vk_surface *surface)
     if (InterlockedDecrement(&surface->ref))
         return;
 
-    EnterCriticalSection(&context_section);
-    list_remove(&surface->entry);
-    LeaveCriticalSection(&context_section);
+    if (surface->entry.next)
+    {
+        EnterCriticalSection(&context_section);
+        list_remove(&surface->entry);
+        LeaveCriticalSection(&context_section);
+    }
 
     if (surface->window)
         XDestroyWindow(gdi_display, surface->window);
-- 
2.33.1




More information about the wine-devel mailing list