Crash in GDBM when SDL2 is cleaned-up using atexit

Sylvain Becker <[email protected]>
Newsgroups gmane.comp.video.mesa3d.user
Message-ID <CADsB45otYZb--a1hPAARi8Lan7JUSyyaoSkqO_eQZ+_SioqVJA@mail.gmail.com>
Hi,

There is a crash when an SDL2 game (Exult), using KMS-DRM back-end,
terminates.
It appears in GBM (gbm_device_destroy()), there migh be also invalid access
in egl datas.

SDL2 issue can be found at https://bugzilla.libsdl.org/show_bug.cgi?id=4530
(with a very small test case)
Exult game at https://github.com/exult

It occurs because:
- Mesa uses atexit()
- Exult game also chooses atexit() to clean up SDL2 internals. (e.g
atexit(SDL_Quit))

Depending on how atexit callbacks are sorted/registered :
- Mesa cleans up first GBM with an atexit().
- If SDL2 tries to clean up things once again and it crashes.

This is reported for SDL2, but any layer using atexit() and GBM could
reproduce the same crash.

There are surely several ways to avoid this, but I wonder what you would
advice to solve this.

Thanks for your help,
Sylvain

_______________________________________________
mesa-users mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.