gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Oct 22 12:21:21 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/f12c72f1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/90c9aaf4 (commit)
	from  https://github.com/Gnucash/gnucash/commit/45925303 (commit)



commit f12c72f10c448f04319fb6cdceda87d550f98e58
Merge: 4592530318 90c9aaf4cb
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Oct 22 09:18:30 2023 -0700

    Merge Simon Arlott's 'bug-799108-sx-crash' into stable.


commit 90c9aaf4cb66f3afc37d9489f8e97a98ae4a6e34
Author: Simon Arlott <sa.me.uk>
Date:   Sat Oct 21 12:04:00 2023 +0100

    Bug 799108 - "Since Last Run" crashes if there are any errors creating a scheduled transaction
    
    Pass a creation_errors list to gnc_sx_instance_model_effect_change() so
    that errors creating SX can be stored, and then display them.

diff --git a/gnucash/gnome/dialog-sx-since-last-run.c b/gnucash/gnome/dialog-sx-since-last-run.c
index 676aa9685d..5248bdb628 100644
--- a/gnucash/gnome/dialog-sx-since-last-run.c
+++ b/gnucash/gnome/dialog-sx-since-last-run.c
@@ -759,8 +759,8 @@ gnc_sx_slr_tree_model_adapter_new (GncSxInstanceModel *instances)
     return rtn;
 }
 
-static void
-creation_error_dialog (GList **creation_errors)
+void
+gnc_ui_sx_creation_error_dialog (GList **creation_errors)
 {
     GtkWidget *dialog = NULL;
     gchar *message = NULL;
@@ -833,7 +833,7 @@ gnc_sx_sxsincelast_book_opened (void)
     g_object_unref (G_OBJECT(inst_model));
 
     if (creation_errors)
-        creation_error_dialog (&creation_errors);
+        gnc_ui_sx_creation_error_dialog (&creation_errors);
 }
 
 static void
@@ -1128,7 +1128,7 @@ dialog_response_cb (GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog
         gnc_resume_gui_refresh ();
         gnc_gui_refresh_all (); // force a refresh of all registers
         if (creation_errors)
-            creation_error_dialog (&creation_errors);
+            gnc_ui_sx_creation_error_dialog (&creation_errors);
 
         if (gtk_toggle_button_get_active (app_dialog->review_created_txns_toggle)
                 && g_list_length (app_dialog->created_txns) > 0)
diff --git a/gnucash/gnome/dialog-sx-since-last-run.h b/gnucash/gnome/dialog-sx-since-last-run.h
index e86b6188e5..6add435289 100644
--- a/gnucash/gnome/dialog-sx-since-last-run.h
+++ b/gnucash/gnome/dialog-sx-since-last-run.h
@@ -52,4 +52,6 @@ GncSxSinceLastRunDialog*  gnc_ui_sx_since_last_run_dialog (GtkWindow *parent,
                                                            GncSxInstanceModel *sx_instances,
                                                            GList *auto_created_txn_guids);
 
+void gnc_ui_sx_creation_error_dialog (GList **creation_errors);
+
 #endif
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c
index 626648f638..ece24d518c 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.c
+++ b/gnucash/gnome/gnc-plugin-basic-commands.c
@@ -475,6 +475,7 @@ gnc_main_window_cmd_actions_since_last_run (GSimpleAction *simple,
     GncSxInstanceModel *sx_instances;
     GncSxSummary summary;
     GList *auto_created_txns = NULL;
+    GList *creation_errors = NULL;
     const char *nothing_to_do_msg =
         _( "There are no Scheduled Transactions to be entered at this time." );
 
@@ -490,7 +491,8 @@ gnc_main_window_cmd_actions_since_last_run (GSimpleAction *simple,
 
     sx_instances = gnc_sx_get_current_instances();
     gnc_sx_instance_model_summarize(sx_instances, &summary);
-    gnc_sx_instance_model_effect_change(sx_instances, TRUE, &auto_created_txns, NULL);
+    gnc_sx_instance_model_effect_change(sx_instances, TRUE, &auto_created_txns,
+                                        &creation_errors);
 
     if (auto_created_txns)
         gnc_gui_refresh_all();
@@ -521,6 +523,9 @@ gnc_main_window_cmd_actions_since_last_run (GSimpleAction *simple,
     }
     g_list_free (auto_created_txns);
     g_object_unref (G_OBJECT(sx_instances));
+
+    if (creation_errors)
+        gnc_ui_sx_creation_error_dialog (&creation_errors);
 }
 
 static void
diff --git a/libgnucash/app-utils/gnc-sx-instance-model.c b/libgnucash/app-utils/gnc-sx-instance-model.c
index e343f6649a..f68351604c 100644
--- a/libgnucash/app-utils/gnc-sx-instance-model.c
+++ b/libgnucash/app-utils/gnc-sx-instance-model.c
@@ -1478,9 +1478,12 @@ gnc_sx_instance_model_effect_change(GncSxInstanceModel *model,
                         gnc_sx_instance_model_change_instance_state
                             (model, inst, SX_INSTANCE_STATE_CREATED);
                     }
-                    else
+                    else if (creation_errors)
+                    {
                         *creation_errors = g_list_concat (*creation_errors,
                                                           instance_errors);
+                        instance_errors = NULL;
+                    }
                     break;
                 case SX_INSTANCE_STATE_REMINDER:
                     // do nothing
@@ -1490,6 +1493,9 @@ gnc_sx_instance_model_effect_change(GncSxInstanceModel *model,
                     g_assert_not_reached();
                     break;
             }
+
+            if (instance_errors)
+                g_list_free_full (instance_errors, g_free);
         }
 
         xaccSchedXactionSetLastOccurDate(instances->sx, last_occur_date);



Summary of changes:
 gnucash/gnome/dialog-sx-since-last-run.c     | 8 ++++----
 gnucash/gnome/dialog-sx-since-last-run.h     | 2 ++
 gnucash/gnome/gnc-plugin-basic-commands.c    | 7 ++++++-
 libgnucash/app-utils/gnc-sx-instance-model.c | 8 +++++++-
 4 files changed, 19 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list