Apply temporary patch to fix SEGV on KDE

This commit is contained in:
Dan Balasescu 2024-04-13 02:26:17 +09:00
parent a0809b8d78
commit f3f5a876c1
No known key found for this signature in database
2 changed files with 47 additions and 0 deletions

View File

@ -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

41
fix-segfault.patch Normal file
View File

@ -0,0 +1,41 @@
From b90577b2af4e7e2b2d74169bbc36d646e6e5c387 Mon Sep 17 00:00:00 2001
From: Dan Balasescu <smoogipoo@smgi.me>
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