[pango] pango: Don't fail to initialize if LC_CTYPE is not set



commit 33b83516e17a6a34265d036f9e02b272cd1b436a
Author: Sebastian Dröge <sebastian centricular com>
Date:   Thu Jun 26 13:15:38 2014 +0200

    pango: Don't fail to initialize if LC_CTYPE is not set
    
    g_once_init_leave() does not work on NULL, and just returns... and
    all future calls to g_once_init_enter() will block forever.
    
    Happens on Android, so let's just fall back to the C locale if there's
    nothing else we can do.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732276

 pango/pango-language.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/pango/pango-language.c b/pango/pango-language.c
index 15d5fb6..e9c9d1f 100644
--- a/pango/pango-language.c
+++ b/pango/pango-language.c
@@ -219,7 +219,14 @@ _pango_get_lc_ctype (void)
 
   return g_strdup (ret);
 #else
-  return g_strdup (setlocale (LC_CTYPE, NULL));
+  {
+    gchar *lc_ctype = setlocale (LC_CTYPE, NULL);
+
+    if (lc_ctype)
+      return g_strdup (lc_ctype);
+    else
+      return g_strdup ("C");
+  }
 #endif
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]