Bug 797295 - problems with entering swedish åäö in company address

scm_c_string_length() returns the wrong answer when the C string is
UTF8: It returns the number of codepoints because the SCM string is in
UTF32, but we need the number of bytes for gtk_text_buffer_set_text.
Fortunately scm_to_utf8_string returns a null-terminated string so
we can just tell gtk_text_buffer_set_text to figure it out on its own.

Guile doesn't use g_malloc so don't use g_free, and gpointer* is a
void** so change the cast to void* for free.
This commit is contained in:
John Ralls 2019-07-11 17:31:49 -07:00
parent 22f22b0a28
commit c9d001d550

View File

@ -3235,8 +3235,8 @@ gnc_option_set_ui_value_text (GNCOption *option, gboolean use_default,
const gchar *string;
string = gnc_scm_to_utf8_string (value);
gtk_text_buffer_set_text (buffer, string, scm_c_string_length(value));
g_free ((gpointer *) string);
gtk_text_buffer_set_text (buffer, string, -1);
free ((void*) string);
return FALSE;
}
else