From 48ca75555522716f0f686dcae3dd6cf3d8ad714d Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 31 May 2022 11:05:19 +0100 Subject: removed idea of repos --- ...rk-fix-initialization-with-c-constructors.patch | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 repo/glib/0001-gquark-fix-initialization-with-c-constructors.patch (limited to 'repo/glib/0001-gquark-fix-initialization-with-c-constructors.patch') diff --git a/repo/glib/0001-gquark-fix-initialization-with-c-constructors.patch b/repo/glib/0001-gquark-fix-initialization-with-c-constructors.patch new file mode 100644 index 0000000..50a9a8c --- /dev/null +++ b/repo/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 +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 + -- cgit v1.2.1