gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Tue Apr 19 11:05:30 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/efbc12b3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/37791b60 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/394e0a4b (commit)
	from  https://github.com/Gnucash/gnucash/commit/27e5515c (commit)



commit efbc12b321aa8d9ff596c72180c70b3f2ec0f8eb
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Apr 19 22:49:26 2022 +0800

    [gnc-main-window] page->window is not main_window, skip warning
    
    This function gets called for both regular register *and* the embedded
    register in the SX template editor. The latter is not a main_window,
    and launching the SX editor would lead to warnings.

diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index a543b79aa..249de0490 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -2481,7 +2481,11 @@ main_window_update_page_set_read_only_icon (GncPluginPage *page,
 
     ENTER(" ");
 
-    g_return_if_fail(page && page->window && GNC_IS_MAIN_WINDOW(page->window));
+    g_return_if_fail (page && page->window);
+
+    if (!GNC_IS_MAIN_WINDOW (page->window))
+        return;
+
     window = GNC_MAIN_WINDOW(page->window);
 
     /* Get the notebook tab widget */

commit 37791b608c6bcfff03365a01c1282419089e5975
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Apr 19 22:42:54 2022 +0800

    [gnc-plugin-page-register] if account==NULL, skip AccountIsPriced
    
    because gnc_plugin_page_register_ui_initial_state may be called for
    non-account registers (eg the sx editor) and account may be null,
    don't call xaccAccountIsPriced on null account.

diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index 136dd52b3..dce7893b3 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -1293,7 +1293,7 @@ gnc_plugin_page_register_ui_initial_state (GncPluginPageRegister* page)
                                "visible", gnc_prefs_is_extra_enabled ());
 
     gnc_plugin_update_actions (action_group, actions_requiring_priced_account,
-                               "sensitive", xaccAccountIsPriced (account));
+                               "sensitive", account && xaccAccountIsPriced (account));
 
     /* Set "style" radio button */
     ledger_type = gnc_ledger_display_type (priv->ledger);

commit 394e0a4b714d0f022a6f07694b013425ae8ebbcb
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Apr 19 22:15:18 2022 +0800

    [gnc-sx-instance-model.c] leak: don't strdup char* for xaccTransSetNotes
    
    For a while now, xaccTransSetNotes would strdup the notes. Don't need
    to strdup it beforehand.

diff --git a/libgnucash/app-utils/gnc-sx-instance-model.c b/libgnucash/app-utils/gnc-sx-instance-model.c
index 924c20b60..6a0583977 100644
--- a/libgnucash/app-utils/gnc-sx-instance-model.c
+++ b/libgnucash/app-utils/gnc-sx-instance-model.c
@@ -1267,9 +1267,7 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data)
 
     /* Bug#500427: copy the notes, if any */
     if (xaccTransGetNotes(template_txn) != NULL)
-    {
-        xaccTransSetNotes(new_txn, g_strdup(xaccTransGetNotes(template_txn)));
-    }
+        xaccTransSetNotes (new_txn, xaccTransGetNotes (template_txn));
 
     xaccTransSetDate(new_txn,
                      g_date_get_day(&creation_data->instance->date),



Summary of changes:
 gnucash/gnome-utils/gnc-main-window.c        | 6 +++++-
 gnucash/gnome/gnc-plugin-page-register.c     | 2 +-
 libgnucash/app-utils/gnc-sx-instance-model.c | 4 +---
 3 files changed, 7 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list