Blame SOURCES/0005-wayland-Detach-hidden-surfaces-in-HideWindow-not-Sho.patch

e54a86
From e2d74bcbe524960c17c852466130a6e0a30674a3 Mon Sep 17 00:00:00 2001
e54a86
From: Ethan Lee <flibitijibibo@gmail.com>
e54a86
Date: Tue, 25 Jan 2022 11:16:09 -0500
e54a86
Subject: [PATCH 05/11] wayland: Detach hidden surfaces in HideWindow, not
e54a86
 ShowWindow
e54a86
e54a86
---
e54a86
 src/video/wayland/SDL_waylandwindow.c | 10 ++++------
e54a86
 1 file changed, 4 insertions(+), 6 deletions(-)
e54a86
e54a86
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
e54a86
index 3b21af7be..2bf500a91 100644
e54a86
--- a/src/video/wayland/SDL_waylandwindow.c
e54a86
+++ b/src/video/wayland/SDL_waylandwindow.c
e54a86
@@ -725,12 +725,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
e54a86
     SDL_VideoData *c = _this->driverdata;
e54a86
     SDL_WindowData *data = window->driverdata;
e54a86
 
e54a86
-    /* Detach any previous buffers before resetting everything, otherwise when
e54a86
-     * calling this a second time you'll get an annoying protocol error
e54a86
-     */
e54a86
-    wl_surface_attach(data->surface, NULL, 0, 0);
e54a86
-    wl_surface_commit(data->surface);
e54a86
-
e54a86
     /* Create the shell surface and map the toplevel */
e54a86
 #ifdef HAVE_LIBDECOR_H
e54a86
     if (c->shell.libdecor) {
e54a86
@@ -862,6 +856,10 @@ void Wayland_HideWindow(_THIS, SDL_Window *window)
e54a86
             wind->shell_surface.xdg.surface = NULL;
e54a86
         }
e54a86
     }
e54a86
+
e54a86
+    /* Be sure to detach after this is done, otherwise ShowWindow crashes! */
e54a86
+    wl_surface_attach(wind->surface, NULL, 0, 0);
e54a86
+    wl_surface_commit(wind->surface);
e54a86
 }
e54a86
 
e54a86
 static void
e54a86
-- 
e54a86
2.34.1
e54a86