From 978c94a2ba551cd34e1152e892ed544a7728ff35 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 29 Aug 2011 23:40:34 +0300 Subject: [PATCH] * mu-util: forward-port the MacOS/g_slice workaround --- src/mu-util.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/mu-util.c b/src/mu-util.c index 2fc285a4..e747dc91 100644 --- a/src/mu-util.c +++ b/src/mu-util.c @@ -156,19 +156,23 @@ mu_util_init_system (void) /* without setlocale, non-ascii cmdline params (like search * terms) won't work */ setlocale (LC_ALL, ""); + + /* on FreeBSD, it seems g_slice_new and friends lead to + * segfaults. Same for MacOS. We cannot easily debug what is + * going on there (no access to such a system), so all we can + * do is add a lame fallback -> we let g_slice_* use normal + * malloc + */ +#ifndef __linux__ + if (!g_setenv ("G_SLICE", "always-malloc", TRUE)) { + g_critical ("cannot set G_SLICE"); + return FALSE; + } + /* g_debug ("setting G_SLICE to always-malloc"); */ +#endif /*!__linux__*/ - /* on FreeBSD, it seems g_slice_new and friends lead to - * segfaults. So we shut if off */ -#ifdef __FreeBSD__ - if (!g_setenv ("G_SLICE", "always-malloc", TRUE)) { - g_critical ("cannot set G_SLICE"); - return FALSE; - } - MU_WRITE_LOG("setting G_SLICE to always-malloc"); -#endif /*__FreeBSD__*/ - g_type_init (); - + return TRUE; }