gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Dec 16 15:09:04 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/9d15e70c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1da24645 (commit)
	from  https://github.com/Gnucash/gnucash/commit/50ca650a (commit)



commit 9d15e70ce2f06be0b3eafa8b836d1abb3a43fa03
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Dec 16 12:02:21 2023 -0800

    Bug 799148 - Reliable crash when saving a modified saved report...
    
    configuration.
    
    The user's saved configurations included some based on a bad
    report-id, so handle the hash table returning #f by skipping that configuration.
    
    There's an odd side-effect: The Save Configuration As action doesn't
    prepare the dialog to edit the saved configuration name, the user must
    find the new configuration and rename it. It works correctly if there
    are no discarded configurations.

diff --git a/gnucash/report/report-core.scm b/gnucash/report/report-core.scm
index 8d7868dab6..167491d95e 100644
--- a/gnucash/report/report-core.scm
+++ b/gnucash/report/report-core.scm
@@ -645,11 +645,14 @@ not found.")))
 (define (gnc:report-template-serialize report-template)
   (let* ((name (gnc:report-template-name report-template))
          (type (gnc:report-template-parent-type report-template))
-         (templ-name (gnc:report-template-name
-                      (hash-ref *gnc:_report-templates_* type)))
-         (options (gnc:report-template-new-options report-template))
-         (guid (gnc:report-template-report-guid report-template)))
-    (gnc:report-template-serialize-internal name type templ-name options guid)))
+         (tmpl (hash-ref *gnc:_report-templates_* type)))
+    (cond
+     ((not tmpl) (gnc:warn "gnc:report-template-serialize: cannot find template for " type) #f)
+     (else
+      (let ((templ-name (gnc:report-template-name tmpl))
+            (options (gnc:report-template-new-options report-template))
+            (guid (gnc:report-template-report-guid report-template)))
+        (gnc:report-template-serialize-internal name type templ-name options guid))))))
 
 ;; Convert a report into a report template and save this template in the savefile
 ;; Under specific conditions the we will attempt to replace the current report's
@@ -712,7 +715,7 @@ not found.")))
 
 (define (gnc:report-template-save-to-savefile report-template)
   (let ((saved-form (gnc:report-template-serialize report-template)))
-    (gnc-saved-reports-write-to-file saved-form #f)))
+    (and saved-form (gnc-saved-reports-write-to-file saved-form #f))))
 
 ;; save all custom reports, moving the old version of the
 ;; saved-reports file aside as a backup

commit 1da246457765b31505b1c109f03ae29d5ed610ce
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Dec 16 11:56:15 2023 -0800

    Reports: Don't crash when report generator fails without backtrace.

diff --git a/gnucash/report/gnc-report.cpp b/gnucash/report/gnc-report.cpp
index e7b933675c..bd208fe96e 100644
--- a/gnucash/report/gnc-report.cpp
+++ b/gnucash/report/gnc-report.cpp
@@ -227,13 +227,20 @@ gnc_run_report_with_error_handling (gint report_id, gchar ** data, gchar **errms
         *errmsg = NULL;
         return TRUE;
     }
-    else
+    else if (scm_is_string (captured_error))
     {
         *errmsg = gnc_scm_to_utf8_string (captured_error);
         *data = NULL;
         PWARN ("Error in report: %s", *errmsg);
         return FALSE;
     }
+    else
+    {
+        *data = nullptr;
+        PWARN("Report %s Failed to generate html but didn't raise a Scheme exception.",
+              gnc_report_name (report));
+        return FALSE;
+    }
 }
 
 gchar*



Summary of changes:
 gnucash/report/gnc-report.cpp  |  9 ++++++++-
 gnucash/report/report-core.scm | 15 +++++++++------
 2 files changed, 17 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list