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.
Sam Lantinga 2020-06-19 10:37:14 -07:00
parent 56622f9c92
commit b9f55b6d80
1 changed files with 1 additions and 2 deletions

View File

@ -798,6 +798,7 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
} }
/* Setup driver data for this window */ /* Setup driver data for this window */
windata->viddata = viddata;
window->driverdata = windata; window->driverdata = windata;
if (KMSDRM_CreateSurfaces(_this, window)) { 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 /* Add window to the internal list of tracked windows. Note, while it may
seem odd to support multiple fullscreen windows, some apps create an seem odd to support multiple fullscreen windows, some apps create an
extra window as a dummy surface when working with multiple contexts */ extra window as a dummy surface when working with multiple contexts */
windata->viddata = viddata;
if (viddata->num_windows >= viddata->max_windows) { if (viddata->num_windows >= viddata->max_windows) {
int new_max_windows = viddata->max_windows + 1; int new_max_windows = viddata->max_windows + 1;
viddata->windows = (SDL_Window **)SDL_realloc(viddata->windows, viddata->windows = (SDL_Window **)SDL_realloc(viddata->windows,