From f680823dbfff5cc90c98139c755c727f2f19d4cb Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 13 Apr 2018 14:02:57 -0700 Subject: [PATCH] Bug 795039 - Crash on startup using Technicolor Style sheet in report The mingw-w64 toolchain bizarrely substitutes scm_to_locale_string() for scm_to_utf8_string(). This results in latin1 (yeah, "locale" is a lie) instead of utf8 which causes an assertion in g_utf8_collate_key(). Perhaps equally bizarre, the compiler doesn't make the substitution with scm_to_utf8_stringn(), so use that instead. --- libgnucash/app-utils/gnc-ui-util.c | 4 ++-- libgnucash/core-utils/gnc-guile-utils.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libgnucash/app-utils/gnc-ui-util.c b/libgnucash/app-utils/gnc-ui-util.c index c4e3a86c0d..5fa6430842 100644 --- a/libgnucash/app-utils/gnc-ui-util.c +++ b/libgnucash/app-utils/gnc-ui-util.c @@ -590,13 +590,13 @@ gnc_ui_account_get_tax_info_string (const Account *account) { gchar *form = NULL; - /* Note: using scm_to_utf8_string directly here instead + /* Note: using scm_to_utf8_stringn directly here instead of our wrapper gnc_scm_to_utf8_string. 'form' should be freed with 'free' instead of 'g_free'. This will be taken care of automatically during scm_dynwind_end, because we inform guile of this memory allocation via scm_dynwind_free a little further. */ - form = scm_to_utf8_string (form_scm); + form = scm_to_utf8_stringn (form_scm, NULL); if (!form) { if (tax_related) diff --git a/libgnucash/core-utils/gnc-guile-utils.c b/libgnucash/core-utils/gnc-guile-utils.c index e86fe9f7f3..99e46d7d2c 100644 --- a/libgnucash/core-utils/gnc-guile-utils.c +++ b/libgnucash/core-utils/gnc-guile-utils.c @@ -43,7 +43,7 @@ gchar *gnc_scm_to_utf8_string(SCM scm_string) gchar* s; char * str; - str = scm_to_utf8_string(scm_string); + str = scm_to_utf8_stringn(scm_string, NULL); s = g_strdup(str); free (str); return s;