Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug 5007 - Segfault in KMSDRM_VideoQuit() on Raspberry Pi Zero …
…with no display attached

Charles Huber

This patch fixes the segfault on my Pi, though the valid display index range reported by the CHECK_DISPLAY_INDEX() macro in src/video/SDL_video.c is a little weird:

$ SDL_VIDEO_EGL_DRIVER=libEGL.so SDL_VIDEO_GL_DRIVER=libGLESv2.so ./a.out
SDL_Init(): displayIndex must be in the range 0 - -1
  • Loading branch information
slouken committed Mar 2, 2020
1 parent f00ddd0 commit a19757a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/video/kmsdrm/SDL_kmsdrmvideo.c
Expand Up @@ -650,7 +650,7 @@ KMSDRM_VideoQuit(_THIS)
viddata->num_windows = 0;

/* Restore saved CRTC settings */
if (viddata->drm_fd >= 0 && dispdata->conn && dispdata->saved_crtc) {
if (viddata->drm_fd >= 0 && dispdata && dispdata->conn && dispdata->saved_crtc) {
drmModeConnector *conn = dispdata->conn;
drmModeCrtc *crtc = dispdata->saved_crtc;

Expand All @@ -661,11 +661,11 @@ KMSDRM_VideoQuit(_THIS)
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not restore original CRTC mode");
}
}
if (dispdata->conn) {
if (dispdata && dispdata->conn) {
KMSDRM_drmModeFreeConnector(dispdata->conn);
dispdata->conn = NULL;
}
if (dispdata->saved_crtc) {
if (dispdata && dispdata->saved_crtc) {
KMSDRM_drmModeFreeCrtc(dispdata->saved_crtc);
dispdata->saved_crtc = NULL;
}
Expand Down

0 comments on commit a19757a

Please sign in to comment.