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.
This commit is contained in:
John Ralls 2018-04-13 14:02:57 -07:00
parent 01420adb99
commit f680823dbf
2 changed files with 3 additions and 3 deletions

View File

@ -590,13 +590,13 @@ gnc_ui_account_get_tax_info_string (const Account *account)
{ {
gchar *form = NULL; 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 of our wrapper gnc_scm_to_utf8_string. 'form' should
be freed with 'free' instead of 'g_free'. This will be freed with 'free' instead of 'g_free'. This will
be taken care of automatically during scm_dynwind_end, be taken care of automatically during scm_dynwind_end,
because we inform guile of this memory allocation via because we inform guile of this memory allocation via
scm_dynwind_free a little further. */ scm_dynwind_free a little further. */
form = scm_to_utf8_string (form_scm); form = scm_to_utf8_stringn (form_scm, NULL);
if (!form) if (!form)
{ {
if (tax_related) if (tax_related)

View File

@ -43,7 +43,7 @@ gchar *gnc_scm_to_utf8_string(SCM scm_string)
gchar* s; gchar* s;
char * str; char * str;
str = scm_to_utf8_string(scm_string); str = scm_to_utf8_stringn(scm_string, NULL);
s = g_strdup(str); s = g_strdup(str);
free (str); free (str);
return s; return s;