Skip to content

Commit

Permalink
Fixed bug 5199 - Fix KMSDRM_CreateWindow() segfault when starting L?V…
Browse files Browse the repository at this point in the history
…E2D 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.
  • Loading branch information
slouken committed Jun 19, 2020
1 parent 56622f9 commit b9f55b6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/video/kmsdrm/SDL_kmsdrmvideo.c
Expand Up @@ -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)) {
Expand All @@ -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,
Expand Down

0 comments on commit b9f55b6

Please sign in to comment.