Further debugging shows this wasn't the root cause, instead the X BadShmSeg error is happening inside libGLX.so.0 function glXSwapBuffers, which is called from src/video/x11/SDL_x11opengl.c, function X11_GL_SwapWindow. As such I guess the bug may actually be in GLX.
2022-11-11 19:37 GMT+08:00, 王昊然 <msl0000023...@gmail.com>: > --- src/video/x11/SDL_x11framebuffer.c.orig2022-01-08 10:29:52.000000000 > +0800 > +++ src/video/x11/SDL_x11framebuffer.c2022-11-11 19:27:12.527050231 +0800 > @@ -42,6 +42,10 @@ > > static SDL_bool have_mitshm(Display *dpy) > { > + const char *no_shm = SDL_getenv("SDL_VIDEO_X11_NO_SHM"); > + if(no_shm && *no_shm) { > + return SDL_FALSE; > + } > /* Only use shared memory on local X servers */ > return X11_XShmQueryExtension(dpy) ? SDL_X11_HAVE_SHM : SDL_FALSE; > } >