Calling SDL_Quit() in atterm() or atexit() cause segfault on MESA due to libgbm

Create issue
Issue #273 resolved
Former user created an issue

Hi there,

I have been fixing my own builds of ECWolf for years now, but I think its time to report: using atexit() or atterm() to call SDL_Quit() causes segfault on light GNU/Linux systems with no X server which rely on KMSDRM using libgbm.

This is a known SDL2 issue with MESA: https://bugzilla.libsdl.org/show_bug.cgi?id=4530 https://lists.freedesktop.org/archives/mesa-users/2019-March/001519.html Look at MESA reply on this: https://lists.freedesktop.org/archives/mesa-users/2019-March/001520.html

Since using atterm() or atexit() to call MESA/libgbm deinit functiions inside SDL_Quit() is NOT a good idea at all, I recommend detecting if a subsystem has been init, and shut it down if it has.

Would you accept a PR fixing this (ie removing the use of atterm() for SDL2 shutdown)?

Comments (4)

  1. Braden Obrzut

    Duplicate of #266 which apparently was 7 months ago… Feel free to open your pull request and I’ll try to carve out some time this weekend to figure out how I want to go about this and if your solution matches what I would do.

  2. Log in to comment