Fix loop of split account reassignments in xaccGroupMergeAccounts, because the commit of one split will change the list itself. Potentially fix 337048.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13773 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2006-04-13 19:39:37 +00:00
parent e7abbc61d4
commit 9b47d47ec4
2 changed files with 8 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2006-04-13 Andreas Köhler <andi5.py@gmx.net>
* src/engine/Group.c: Fix loop of split account reassignments in
xaccGroupMergeAccounts, because the commit of one split will
change the list itself. Potentially fix 337048.
2006-04-12 David Hampton <hampton@employees.org>
* src/engine/gnc-commodity.c: Update the determination of what's a

View File

@ -917,7 +917,6 @@ xaccGroupMergeAccounts (AccountGroup *grp)
(xaccAccountGetType(acc_a) == xaccAccountGetType(acc_b)))
{
AccountGroup *ga, *gb;
GList *lp;
/* consolidate children */
ga = (AccountGroup *) acc_a->children;
@ -946,20 +945,8 @@ xaccGroupMergeAccounts (AccountGroup *grp)
xaccGroupMergeAccounts (ga);
/* consolidate transactions */
lp = acc_b->splits;
for (lp = acc_b->splits; lp; lp = lp->next)
{
Split *split = lp->data;
qof_event_gen (&xaccSplitGetAccount(split)->inst.entity,
QOF_EVENT_MODIFY, NULL);
split->acc = NULL;
xaccAccountInsertSplit (acc_a, split);
}
g_list_free(acc_b->splits);
acc_b->splits = NULL;
while (acc_b->splits)
xaccSplitSetAccount (acc_b->splits->data, acc_a);
/* move back one before removal */
node_b = node_b->prev;