From cf327060c5bb6b13f1c0b76ff0dad296a7c85982 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Thu, 25 Jul 2019 17:37:03 +0100
Subject: [PATCH] utils: Ensure that g_type_init() gets called

In GLib < 2.36, this wasn't automatic.

The constructor has been backported into the SteamRT 1 'scout' version
of GLib, but if you have an environment with more Ubuntu 12.04
apt sources available (like the official SDK schroot from
setup_chroot.sh), they might override the SteamRT-patched version.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 steam-runtime-tools/utils.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/steam-runtime-tools/utils.c b/steam-runtime-tools/utils.c
index 89721b4e6..e17191294 100644
--- a/steam-runtime-tools/utils.c
+++ b/steam-runtime-tools/utils.c
@@ -29,6 +29,8 @@
 #include <link.h>
 #include <string.h>
 
+#include <glib-object.h>
+
 static gchar *helpers_path = NULL;
 
 G_GNUC_INTERNAL const char *
@@ -95,3 +97,12 @@ out:
 
   return path;
 }
+
+#if !GLIB_CHECK_VERSION(2, 36, 0)
+static void _srt_constructor (void) __attribute__((__constructor__));
+static void
+_srt_constructor (void)
+{
+  g_type_init ();
+}
+#endif
-- 
GitLab