pulseaudio: fix dependencies for openssl-3
[oi-userland.git] / components / x11 / mesa / patches / patch-src_glx_dri__common.c.patch
blob5367f1c52b53fb044fa53743963619a5a7205ba0
1 $NetBSD: patch-src_glx_dri__common.c,v 1.1 2022/03/13 15:52:50 tnn Exp $
3 atexit() is not a good idea in shared libraries.
5 FreeBSD reported atexit bug for 10.6:
6 https://bugs.freedesktop.org/show_bug.cgi?id=91869
8 --- src/glx/dri_common.c.orig 2021-07-14 20:04:55.743010300 +0000
9 +++ src/glx/dri_common.c
10 @@ -690,9 +690,19 @@ static struct driver_config_entry *drive
11 /* Called as an atexit function. Otherwise, this would have to be called with
12 * driver_config_mutex locked.
14 +#if defined(HAVE_NOATEXIT)
15 +static Bool e_next_ever_null = False;
17 +static void __attribute__((__destructor__))
18 +#else
19 static void
20 +#endif
21 clear_driver_config_cache()
23 +#if defined(HAVE_NOATEXIT)
24 + if (!e_next_ever_null)
25 + return;
26 +#endif
27 while (driver_config_cache) {
28 struct driver_config_entry *e = driver_config_cache;
29 driver_config_cache = e->next;
30 @@ -777,7 +787,11 @@ glXGetDriverConfig(const char *driverNam
31 driver_config_cache = e;
33 if (!e->next)
34 +#if defined(HAVE_NOATEXIT)
35 + e_next_ever_null = True;
36 +#else
37 atexit(clear_driver_config_cache);
38 +#endif
40 out:
41 pthread_mutex_unlock(&driver_config_mutex);