[Gnucash-changes] r13773 - gnucash/trunk - Fix loop of split account reassignments in xaccGroupMergeAccounts, because the commit of one split will change the list itself. Potentially fix 337048.

Andreas Köhler andi5 at cvs.gnucash.org
Thu Apr 13 15:39:39 EDT 2006


Author: andi5
Date: 2006-04-13 15:39:37 -0400 (Thu, 13 Apr 2006)
New Revision: 13773
Trac: http://svn.gnucash.org/trac/changeset/13773

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/engine/Group.c
Log:
Fix loop of split account reassignments in xaccGroupMergeAccounts, because the commit of one split will change the list itself. Potentially fix 337048.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-04-13 09:01:44 UTC (rev 13772)
+++ gnucash/trunk/ChangeLog	2006-04-13 19:39:37 UTC (rev 13773)
@@ -1,3 +1,9 @@
+2006-04-13  Andreas Köhler  <andi5.py at 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 at employees.org>
 
 	* src/engine/gnc-commodity.c: Update the determination of what's a

Modified: gnucash/trunk/src/engine/Group.c
===================================================================
--- gnucash/trunk/src/engine/Group.c	2006-04-13 09:01:44 UTC (rev 13772)
+++ gnucash/trunk/src/engine/Group.c	2006-04-13 19:39:37 UTC (rev 13773)
@@ -917,7 +917,6 @@
           (xaccAccountGetType(acc_a) == xaccAccountGetType(acc_b)))
       {
         AccountGroup *ga, *gb;
-        GList *lp;
 
         /* consolidate children */
         ga = (AccountGroup *) acc_a->children;
@@ -946,21 +945,9 @@
         xaccGroupMergeAccounts (ga);
 
         /* consolidate transactions */
-        lp = acc_b->splits;
-        
-        for (lp = acc_b->splits; lp; lp = lp->next)
-        {
-          Split *split = lp->data;
+        while (acc_b->splits)
+          xaccSplitSetAccount (acc_b->splits->data, acc_a);
 
-          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;
-
         /* move back one before removal */
         node_b = node_b->prev;
 



More information about the gnucash-changes mailing list