gnucash master: Bug727130 - Crash when newline in Report Title

Geert Janssens gjanssens at code.gnucash.org
Fri Apr 4 10:35:06 EDT 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/c9b5a81b (commit)
	from  https://github.com/Gnucash/gnucash/commit/1688e6c2 (commit)



commit c9b5a81b083968695723fa4a215a7dba591c7a05
Author: Carsten Rinke <carsten.rinke at gmx.de>
Date:   Sun Mar 30 11:48:13 2014 +0200

    Bug727130 - Crash when newline in Report Title

diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c
index 8ad613f..8878177 100644
--- a/src/report/report-gnome/gnc-plugin-page-report.c
+++ b/src/report/report-gnome/gnc-plugin-page-report.c
@@ -587,6 +587,7 @@ gnc_plugin_page_report_option_change_cb(gpointer data)
     SCM dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
     const gchar *old_name;
     gchar *new_name;
+    gchar *new_name_escaped;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(data));
     report = GNC_PLUGIN_PAGE_REPORT(data);
@@ -602,7 +603,13 @@ gnc_plugin_page_report_option_change_cb(gpointer data)
     new_name = gnc_option_db_lookup_string_option(priv->cur_odb, "General",
                "Report name", NULL);
     if (strcmp(old_name, new_name) != 0)
-        main_window_update_page_name(GNC_PLUGIN_PAGE(report), new_name);
+    {
+        /* Bug 727130 - escape the non-printable characters from the name */
+        new_name_escaped = g_strescape(new_name,NULL);
+        ENTER("Escaped new report name: %s", new_name_escaped);
+        main_window_update_page_name(GNC_PLUGIN_PAGE(report), new_name_escaped);
+        g_free(new_name_escaped);
+	}
     g_free(new_name);
 
     /* it's probably already dirty, but make sure */



Summary of changes:
 src/report/report-gnome/gnc-plugin-page-report.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list