diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-03-01 14:29:09 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-03-01 14:29:09 -0600 |
commit | 9ff5454e7495f78da016bde184e76881e3c183b3 (patch) | |
tree | 58124db894edcbb1d665612633f16566417fc727 /harmony/glib/0001-gquark-fix-initialization-with-c-constructors.patch | |
parent | 471f8326818e66d3198631518225a87267b6f8da (diff) | |
download | packages-9ff5454e7495f78da016bde184e76881e3c183b3.tar.gz packages-9ff5454e7495f78da016bde184e76881e3c183b3.tar.bz2 packages-9ff5454e7495f78da016bde184e76881e3c183b3.tar.xz packages-9ff5454e7495f78da016bde184e76881e3c183b3.zip |
harmony/glib: poach this from old aports fork
Diffstat (limited to 'harmony/glib/0001-gquark-fix-initialization-with-c-constructors.patch')
-rw-r--r-- | harmony/glib/0001-gquark-fix-initialization-with-c-constructors.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/harmony/glib/0001-gquark-fix-initialization-with-c-constructors.patch b/harmony/glib/0001-gquark-fix-initialization-with-c-constructors.patch new file mode 100644 index 000000000..50a9a8c28 --- /dev/null +++ b/harmony/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 + |