From b9f55b6d805446856b435b76442c59711603aef9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 19 Jun 2020 10:37:14 -0700 Subject: [PATCH] Fixed bug 5199 - Fix KMSDRM_CreateWindow() segfault when starting L?VE2D engine. Manuel Alfayate Corchete This small patch fixes the KMSDRM_CreateSurfaces() call in KMSDRM_CreateWindow(), that was segfaulting deeper into SDL internals because the windata->viddata pointer wasn't set before the KMSDRM_CreateSurfaces() call. So that's what this small patch does. Now, L?VE2D works perfectly well on the Raspberry Pi 3, instead of just segfaulting. --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index e00f9590e..710a6a009 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -798,6 +798,7 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window) } /* Setup driver data for this window */ + windata->viddata = viddata; window->driverdata = windata; if (KMSDRM_CreateSurfaces(_this, window)) { @@ -807,8 +808,6 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window) /* Add window to the internal list of tracked windows. Note, while it may seem odd to support multiple fullscreen windows, some apps create an extra window as a dummy surface when working with multiple contexts */ - windata->viddata = viddata; - if (viddata->num_windows >= viddata->max_windows) { int new_max_windows = viddata->max_windows + 1; viddata->windows = (SDL_Window **)SDL_realloc(viddata->windows,