totem: depend on GStreamer Good Plug-ins
[oi-userland.git] / components / x11 / mesa / patches / patch-src_util_u__queue.c.patch
blobefaacbebacec167cbcc29b681e890e7b83c9247b
1 $NetBSD: patch-src_util_u__queue.c,v 1.3 2022/03/13 15:50:05 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/util/u_queue.c.orig 2021-07-14 20:04:59.260044300 +0000
9 +++ src/util/u_queue.c
10 @@ -58,11 +58,22 @@ static once_flag atexit_once_flag = ONCE
11 static struct list_head queue_list;
12 static mtx_t exit_mutex = _MTX_INITIALIZER_NP;
14 +#if defined(HAVE_NOATEXIT)
15 +static int global_init_called = 0;
17 +static void __attribute__((__destructor__))
18 +#else
19 static void
20 +#endif
21 atexit_handler(void)
23 struct util_queue *iter;
25 +#if defined(HAVE_NOATEXIT)
26 + if (!global_init_called)
27 + return;
28 +#endif
30 mtx_lock(&exit_mutex);
31 /* Wait for all queues to assert idle. */
32 LIST_FOR_EACH_ENTRY(iter, &queue_list, head) {
33 @@ -75,7 +86,11 @@ static void
34 global_init(void)
36 list_inithead(&queue_list);
37 +#if defined(HAVE_NOATEXIT)
38 + global_init_called = 1;
39 +#else
40 atexit(atexit_handler);
41 +#endif
44 static void