From f3f5a876c1a40476146282c3dc70bb9fa48d3cda Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 13 Apr 2024 02:26:17 +0900 Subject: [PATCH] Apply temporary patch to fix SEGV on KDE --- .github/workflows/build.yml | 6 ++++++ fix-segfault.patch | 41 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 fix-segfault.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5c75f6..981569f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,6 +81,12 @@ jobs: with: path: 'SDL3-CS' + - name: Apply temporary patch + if: runner.os == 'Linux' + run: | + # Remove when https://github.com/libsdl-org/SDL/pull/9523 is merged. + git apply SDL3-CS/fix-segfault.patch + - name: Configure CMake run: ${{ matrix.platform.cmake_configure_env }} cmake -B build ${{ matrix.platform.flags }} -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON diff --git a/fix-segfault.patch b/fix-segfault.patch new file mode 100644 index 0000000..6178803 --- /dev/null +++ b/fix-segfault.patch @@ -0,0 +1,41 @@ +From b90577b2af4e7e2b2d74169bbc36d646e6e5c387 Mon Sep 17 00:00:00 2001 +From: Dan Balasescu +Date: Sat, 13 Apr 2024 01:56:52 +0900 +Subject: [PATCH] Fix segmentation fault on Wayland 1.18 + KDE + +The CI build matrix uses Ubuntu 20.04 as one of its configurations. +This platform only comes with Wayland 1.18, but the display output +name is only available since Wayland 1.20 (output version 4). + +This was considered in other areas, for example the main function that +reads this value mentions version 4 specifically: + +https://github.com/libsdl-org/SDL/blob/60f26182c3a44544f78c1569906fdf58d1d69374/src/video/wayland/SDL_waylandvideo.c#L915 + +... and the different versions are selected when adding displays: + +https://github.com/libsdl-org/SDL/blob/60f26182c3a44544f78c1569906fdf58d1d69374/src/video/wayland/SDL_waylandvideo.c#L85-L89 + +We are also providing binaries of our own compiled on Ubuntu 20.04 +(still generally supported until 2025-06) specifically to target a +lower GLIBC version. +--- + src/video/wayland/SDL_waylandvideo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c +index 105ed67d9..5c7344b15 100644 +--- a/src/video/wayland/SDL_waylandvideo.c ++++ b/src/video/wayland/SDL_waylandvideo.c +@@ -248,7 +248,7 @@ static void Wayland_SortOutputs(SDL_VideoData *vid) + /* KDE provides the kde-output-order-v1 protocol, which gives us the full preferred display + * ordering in the form of a list of wl_output.name strings (connector names). + */ +- if (!WAYLAND_wl_list_empty(&vid->output_order)) { ++ if (!WAYLAND_wl_list_empty(&vid->output_order) && SDL_WL_OUTPUT_VERSION >= WL_OUTPUT_NAME_SINCE_VERSION) { + struct wl_list sorted_list; + SDL_WaylandConnectorName *c; + +-- +2.44.0 +