diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-06-08 02:02:24 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-06-08 02:02:24 -0500 |
commit | fd2bb2f751c13b3c0c002b8e012810902b9da364 (patch) | |
tree | 17b2e38c966c9f96cfa568c1f572261a289590e6 /system/glib/0001-gquark-fix-initialization-with-c-constructors.patch | |
parent | b0a5136bf3326ba38b360be288d06f9a27f2a4d2 (diff) | |
download | packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.gz packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.bz2 packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.xz packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.zip |
harmony -> system
Diffstat (limited to 'system/glib/0001-gquark-fix-initialization-with-c-constructors.patch')
-rw-r--r-- | system/glib/0001-gquark-fix-initialization-with-c-constructors.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch b/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch new file mode 100644 index 000000000..50a9a8c28 --- /dev/null +++ b/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch @@ -0,0 +1,47 @@ +From e4216dee57f5156e192b2910f13eb855a104cb18 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Wed, 6 Jul 2016 12:38:40 +0200 +Subject: [PATCH] gquark: fix initialization with c++ constructors + +C++ constructors may want create new quarks, but we can not guarantee +that the glib library ctor is executed first. Therefore we make sure +that quarks are always initialized from g_quark_from_string and +g_quark_from_static_string + +This fixes crashes in glibmm with musl which likely happens on AIX too. + +https://bugzilla.gnome.org/show_bug.cgi?id=768215 +https://bugzilla.gnome.org/show_bug.cgi?id=756139#c14 +--- + glib/gquark.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/glib/gquark.c b/glib/gquark.c +index 9e51a92..17ecd7f 100644 +--- a/glib/gquark.c ++++ b/glib/gquark.c +@@ -57,6 +57,11 @@ static gint quark_block_offset = 0; + void + g_quark_init (void) + { ++ /* we may be initialized from c++ constructor or the glib ctor, but we ++ cannot guarantee in what order. So we check if we have been initialized */ ++ if (quark_ht != NULL) ++ 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); +@@ -179,6 +184,9 @@ quark_from_string (const gchar *string, + { + GQuark quark = 0; + ++ if (G_UNLIKELY (quark_ht == NULL)) ++ g_quark_init(); ++ + quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string)); + + if (!quark) +-- +2.9.0 + |