gnucash stable: [Account.cpp] xaccAccountStagedTransactionTraversal copies SplitsVec
Christopher Lam
clam at code.gnucash.org
Tue Jun 18 08:29:34 EDT 2024
Updated via https://github.com/Gnucash/gnucash/commit/b7fde904 (commit)
from https://github.com/Gnucash/gnucash/commit/f19e4620 (commit)
commit b7fde90411d6ab19cbcd814862417f2f20f1935a
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Jun 18 20:24:36 2024 +0800
[Account.cpp] xaccAccountStagedTransactionTraversal copies SplitsVec
because create_transactions_for_instance which calls
xaccAccountStagedTransactionTraversal will modify the splits
diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp
index 462a4be51f..d5863a8491 100644
--- a/libgnucash/engine/Account.cpp
+++ b/libgnucash/engine/Account.cpp
@@ -5550,7 +5550,8 @@ xaccAccountStagedTransactionTraversal (const Account *acc,
{
if (!acc) return 0;
- auto& splits = GET_PRIVATE(acc)->splits;
+ // iterate on copy of splits. some callers modify the splitsvec.
+ auto splits = GET_PRIVATE(acc)->splits;
for (auto s : splits)
{
auto trans = s->parent;
Summary of changes:
libgnucash/engine/Account.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list