Skip to content

Commit e2d74bc

Browse files
committed
wayland: Detach hidden surfaces in HideWindow, not ShowWindow
1 parent ca22b30 commit e2d74bc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/video/wayland/SDL_waylandwindow.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
725725
SDL_VideoData *c = _this->driverdata;
726726
SDL_WindowData *data = window->driverdata;
727727

728-
/* Detach any previous buffers before resetting everything, otherwise when
729-
* calling this a second time you'll get an annoying protocol error
730-
*/
731-
wl_surface_attach(data->surface, NULL, 0, 0);
732-
wl_surface_commit(data->surface);
733-
734728
/* Create the shell surface and map the toplevel */
735729
#ifdef HAVE_LIBDECOR_H
736730
if (c->shell.libdecor) {
@@ -862,6 +856,10 @@ void Wayland_HideWindow(_THIS, SDL_Window *window)
862856
wind->shell_surface.xdg.surface = NULL;
863857
}
864858
}
859+
860+
/* Be sure to detach after this is done, otherwise ShowWindow crashes! */
861+
wl_surface_attach(wind->surface, NULL, 0, 0);
862+
wl_surface_commit(wind->surface);
865863
}
866864

867865
static void

0 commit comments

Comments
 (0)