void-packages/srcpkgs/glib/patches/quark_init_on_demand.patch
Đoàn Trần Công Danh 7fc9190f0e srcpkgs/g*: convert patches to -Np1
* gcc is kept at -Np0, because of void-cross

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

37 lines
903 B
Diff

musl does not run ctors in the assumed order that glib-2.46 expects.
Call g_quark_init() where it is expected to have been called.
--- a/glib/gquark.c 2016-08-17 17:20:47.000000000 +0200
+++ b/glib/gquark.c 2016-08-30 07:49:13.298234757 +0200
@@ -57,6 +57,9 @@
void
g_quark_init (void)
{
+ if (quark_ht)
+ return;
+
g_assert (quark_seq_id == 0);
quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
quarks = g_new (gchar*, QUARK_BLOCK_SIZE);
@@ -138,9 +141,12 @@
return 0;
G_LOCK (quark_global);
+#if !defined(__GLIBC__)
+ g_quark_init ();
+#endif
quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
G_UNLOCK (quark_global);
return quark;
}
@@ -280,6 +286,7 @@
GQuark quark;
gchar **quarks_new;
+ g_quark_init ();
if (quark_seq_id % QUARK_BLOCK_SIZE == 0)
{
quarks_new = g_new (gchar*, quark_seq_id + QUARK_BLOCK_SIZE);