Hi,

Apps linked against SDL2 on loongson would give me SIGBUS errors at
startup, while SDL1 apps run fine.

This was reported to upstream:

https://bugzilla.libsdl.org/show_bug.cgi?id=3692

and a very simple patch was found to fix the issue.

Basically, SDL2 was calling XChangeProperty() with an int argument,
while X11 expects a long argument there.

The following diff was tested on loongson and fixes the issue for me.

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2/Makefile,v
retrieving revision 1.16
diff -u -p -r1.16 Makefile
--- Makefile    14 May 2017 06:40:35 -0000      1.16
+++ Makefile    5 Jul 2017 11:04:20 -0000
@@ -4,7 +4,7 @@ COMMENT=        cross-platform multimedia libra
 BROKEN-hppa=   src/atomic/SDL_spinlock.c:101:2: error: \#error Please 
implement for your platform.
 
 V=             2.0.5
-REVISION=      0
+REVISION=      1
 DISTNAME=      SDL2-${V}
 PKGNAME=       sdl2-${V}
 CATEGORIES=    devel
Index: patches/patch-src_video_x11_SDL_x11window_c
===================================================================
RCS file: patches/patch-src_video_x11_SDL_x11window_c
diff -N patches/patch-src_video_x11_SDL_x11window_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_video_x11_SDL_x11window_c 5 Jul 2017 11:04:20 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+The Xlib documentation demands that 32-bit values here be passed in a long,
+even when long itself isn't a 32-bit value. Otherwise libx11 might read
+memory incorrectly (Bugzilla #3692).
+
+97c66d81b2c9 upstream.
+
+Index: src/video/x11/SDL_x11window.c
+--- src/video/x11/SDL_x11window.c.orig
++++ src/video/x11/SDL_x11window.c
+@@ -376,7 +376,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
+     Atom _NET_WM_WINDOW_TYPE;
+     Atom wintype;
+     const char *wintype_name = NULL;
+-    int compositor = 1;
++    long compositor = 1;
+     Atom _NET_WM_PID;
+     Atom XdndAware, xdnd_version = 5;
+     long fevent = 0;

Reply via email to