gnucash maint: Bug 798346 - crashes when running check & repair

John Ralls jralls at code.gnucash.org
Mon Nov 8 21:08:05 EST 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/ff04ad37 (commit)
	from  https://github.com/Gnucash/gnucash/commit/22f83c86 (commit)



commit ff04ad378581093e7d1efe1f0aaad8cea8712c43
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 8 18:06:29 2021 -0800

    Bug 798346 - crashes when running check & repair
    
    Don't scrub trading accounts for imbalances, see the comment in
    the commit for why.

diff --git a/libgnucash/engine/Scrub.c b/libgnucash/engine/Scrub.c
index 79bb73fd9..424f1baeb 100644
--- a/libgnucash/engine/Scrub.c
+++ b/libgnucash/engine/Scrub.c
@@ -355,6 +355,17 @@ xaccAccountScrubImbalance (Account *acc, QofPercentageFunc percentagefunc)
     gint split_count = 0, curr_split_no = 0;
 
     if (!acc) return;
+    /* If it's a trading account and an imbalanced transaction is
+     * found the trading splits will be replaced, invalidating the
+     * split list in mid-traversal, see
+     * https://bugs.gnucash.org/show_bug.cgi?id=798346. Also the
+     * transactions will get scrubbed at least twice from their "real"
+     * accounts anyway so doing so from the trading accounts is wasted
+     * effort.
+     */
+    if (xaccAccountGetType(acc) == ACCT_TYPE_TRADING)
+         return;
+
     scrub_depth++;
 
     str = xaccAccountGetName(acc);



Summary of changes:
 libgnucash/engine/Scrub.c | 11 +++++++++++
 1 file changed, 11 insertions(+)



More information about the gnucash-changes mailing list