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

John Ralls jralls at code.gnucash.org
Thu Jul 11 20:40:04 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/c9d001d5 (commit)
	from  https://github.com/Gnucash/gnucash/commit/22f22b0a (commit)



commit c9d001d550df2cbfa2b62226288040f0dcbf87e8
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Jul 11 17:31:49 2019 -0700

    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.

diff --git a/gnucash/gnome-utils/dialog-options.c b/gnucash/gnome-utils/dialog-options.c
index 4b22bdefe..e3ae2a32b 100644
--- a/gnucash/gnome-utils/dialog-options.c
+++ b/gnucash/gnome-utils/dialog-options.c
@@ -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



Summary of changes:
 gnucash/gnome-utils/dialog-options.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list