gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Fri Feb 3 19:42:25 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/f54927d9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/730d8bd7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a5d50307 (commit)
	from  https://github.com/Gnucash/gnucash/commit/7bb14b9c (commit)



commit f54927d9cf3f443d6034b3e786f40e199d5f9f4c
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Feb 3 16:35:52 2023 -0800

    [c++options] Parent account types must be included in the types list
    
    Or the selection routine can't show the descendants you want.

diff --git a/gnucash/report/reports/standard/advanced-portfolio.scm b/gnucash/report/reports/standard/advanced-portfolio.scm
index e385f5b3d..2419aa4c4 100644
--- a/gnucash/report/reports/standard/advanced-portfolio.scm
+++ b/gnucash/report/reports/standard/advanced-portfolio.scm
@@ -129,7 +129,7 @@ by preventing negative stock balances.<br/>")
       (filter gnc:account-is-stock?
               (gnc-account-get-descendants-sorted
                (gnc-get-current-root-account)))
-      (list ACCT-TYPE-STOCK))
+      (list ACCT-TYPE-ASSET ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
 
     (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-zero-shares "e"
diff --git a/gnucash/report/reports/standard/investment-lots.scm b/gnucash/report/reports/standard/investment-lots.scm
index 41b688d7f..a15bdd252 100644
--- a/gnucash/report/reports/standard/investment-lots.scm
+++ b/gnucash/report/reports/standard/investment-lots.scm
@@ -147,7 +147,7 @@
       (filter gnc:account-is-stock?
               (gnc-account-get-descendants-sorted
                (gnc-get-current-root-account)))
-    (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
+    (list ACCT-TYPE-ASSET ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
 
     (gnc-register-simple-boolean-option options
         gnc:pagename-accounts
diff --git a/gnucash/report/reports/standard/portfolio.scm b/gnucash/report/reports/standard/portfolio.scm
index 37703a620..9f98b4636 100644
--- a/gnucash/report/reports/standard/portfolio.scm
+++ b/gnucash/report/reports/standard/portfolio.scm
@@ -65,7 +65,7 @@
       (gnc:filter-accountlist-type
        (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)
        (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
-      (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
+      (list ACCT-TYPE-ASSET ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
 
     (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-zero-shares "e"

commit 730d8bd73031ae9a848ad8fdfce7e09dfc1526cf
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Feb 3 16:34:50 2023 -0800

    [c++ options] Don't crash if the option doesn't have a UI item.
    
    Return quietly if it's an internal option and noisily if not.

diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index b0a085c46..35e350f01 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -127,8 +127,9 @@ GncOptionsDialog::changed() noexcept
 void
 gnc_option_changed_widget_cb(GtkWidget *widget, GncOption* option)
 {
-    if (!option) return;
+    if (!option || option->is_internal()) return;
     auto ui_item{option->get_ui_item()};
+    g_return_if_fail(ui_item);
     auto widget_changed_cb{option->get_widget_changed()};
     auto gtk_ui_item{dynamic_cast<GncOptionGtkUIItem*>(ui_item)};
     if (widget_changed_cb && gtk_ui_item)

commit a5d503071b4e60d6158465c71b3da78101b03060
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Feb 3 15:27:14 2023 -0800

    Bug 798739 - Advanced Portfolio report fails
    
    If the retrieved type is too big it over-runs the avi.include_type
    array and corrupts the next node's next pointer.

diff --git a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
index 763a372f0..d239b34bd 100644
--- a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
+++ b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
@@ -948,7 +948,8 @@ create_account_widget(GncOption& option, char *name)
         for (node = acct_type_list; node; node = node->next)
         {
             GNCAccountType type = static_cast<decltype(type)>(GPOINTER_TO_INT (node->data));
-            avi.include_type[type] = TRUE;
+            if (type < NUM_ACCOUNT_TYPES)
+                avi.include_type[type] = TRUE;
         }
 
         gnc_tree_view_account_set_view_info (GNC_TREE_VIEW_ACCOUNT (tree), &avi);



Summary of changes:
 gnucash/gnome-utils/dialog-options.cpp                 | 3 ++-
 gnucash/gnome-utils/gnc-option-gtk-ui.cpp              | 3 ++-
 gnucash/report/reports/standard/advanced-portfolio.scm | 2 +-
 gnucash/report/reports/standard/investment-lots.scm    | 2 +-
 gnucash/report/reports/standard/portfolio.scm          | 2 +-
 5 files changed, 7 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list