Commit 7b239edb838a47f1b0a03b8257f1cd353f9d14c0

Ethan Lee 2021-07-28T01:00:00

wayland: Assign frame_callback on window creation. Fixes a crash when creating and destroying a window without calling SwapWindow.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index daeb55f..244bb48 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1136,7 +1136,8 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
      * window isn't visible.
      */
     if (window->flags & SDL_WINDOW_OPENGL) {
-        wl_callback_add_listener(wl_surface_frame(data->surface), &surface_frame_listener, data);
+        data->frame_callback = wl_surface_frame(data->surface);
+        wl_callback_add_listener(data->frame_callback, &surface_frame_listener, data);
     }
 
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH