head 1.1; access; symbols; locks; strict; comment @ * @; 1.1 date 2026.11.30.09.08.27; author wiz; state Exp; branches; next ; commitid uerpYkcG24mjRs5H; desc @@ 1.1 log @mesa: carry over atexit() patches from MesaLib, simplified Fixes coredumps on exit. Reported upstream, let's see what happens. XXX: there are a couple more atexit() locations remaining that might need patching as well. Bump PKGREVISION. @ text @$NetBSD$ avoid atexit in shared libraries. https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072 --- src/glx/dri_common.c.orig 2026-11-18 15:56:09.000000000 +0000 +++ src/glx/dri_common.c @@@@ -762,9 +762,13 @@@@ static struct driver_config_entry *driver_config_cache /* Called as an atexit function. Otherwise, this would have to be called with * driver_config_mutex locked. */ -static void +static Bool e_next_ever_null = False; + +static void __attribute__((__destructor__)) clear_driver_config_cache() { + if (!e_next_ever_null) + return; while (driver_config_cache) { struct driver_config_entry *e = driver_config_cache; driver_config_cache = e->next; @@@@ -814,7 +818,7 @@@@ glXGetDriverConfig(const char *driverName) driver_config_cache = e; if (!e->next) - atexit(clear_driver_config_cache); + e_next_ever_null = True; out: pthread_mutex_unlock(&driver_config_mutex); @