From 689218ebf54ba6e37102ff3cea7d239d16aa3ad7 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 4 Nov 2022 12:07:20 +0000 Subject: [PATCH] Fix wayland reconnection paths Most of this code is disabled out for now. - For mouse cursors we have a wl_surface for both system and custom cursors which needs recreating. - The other patch is about nullification after deletions --- src/video/wayland/SDL_waylandmouse.c | 7 ++++--- src/video/wayland/SDL_waylandvideo.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 32499fdd7..c35457b5b 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -620,10 +620,9 @@ Wayland_RecreateCursor(SDL_Cursor *cursor, SDL_VideoData *vdata) create_buffer_from_shm(cdata, cdata->w, cdata->h, WL_SHM_FORMAT_ARGB8888); SDL_memcpy(cdata->shm_data, old_data_pointer, stride * cdata->h); - - cdata->surface = wl_compositor_create_surface(vdata->compositor); - wl_surface_set_user_data(cdata->surface, NULL); } + cdata->surface = wl_compositor_create_surface(vdata->compositor); + wl_surface_set_user_data(cdata->surface, NULL); } void @@ -691,7 +690,9 @@ Wayland_FiniMouse(SDL_VideoData *data) for (i = 0; i < data->num_cursor_themes; i += 1) { WAYLAND_wl_cursor_theme_destroy(data->cursor_themes[i].theme); } + data->num_cursor_themes = 0; SDL_free(data->cursor_themes); + data->cursor_themes = NULL; SDL_DelHintCallback(SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP, Wayland_EmulateMouseWarpChanged, input); diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index eccdd0bbb..76b93cd09 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1053,6 +1053,7 @@ Wayland_VideoCleanup(_THIS) display->desktop_mode.driverdata = NULL; SDL_DelVideoDisplay(i); } + data->output_list = NULL; Wayland_display_destroy_input(data); Wayland_display_destroy_pointer_constraints(data);