[Gnucash-changes] r13766 - gnucash/trunk/src/engine - Avoid
generating Transaction modified events for Transaction roll-back.
Chris Shoemaker
chris at cvs.gnucash.org
Mon Apr 10 22:55:58 EDT 2006
Author: chris
Date: 2006-04-10 22:55:57 -0400 (Mon, 10 Apr 2006)
New Revision: 13766
Trac: http://svn.gnucash.org/trac/changeset/13766
Modified:
gnucash/trunk/src/engine/Transaction.c
Log:
Avoid generating Transaction modified events for Transaction roll-back.
Enable emission of some new Split events.
Use xaccSplitRollbackEdit() in implementation of xaccTransRollbackEdit().
Avoid rollback of Splits not owned by the Transaction. This was actually
impossible to encounter, but the algorithm is now correct even for some
cases that aren't permitted by other code.
Modified: gnucash/trunk/src/engine/Transaction.c
===================================================================
--- gnucash/trunk/src/engine/Transaction.c 2006-04-10 22:20:12 UTC (rev 13765)
+++ gnucash/trunk/src/engine/Transaction.c 2006-04-11 02:55:57 UTC (rev 13766)
@@ -229,7 +229,6 @@
}
}
#endif
- qof_event_gen (&trans->inst.entity, QOF_EVENT_MODIFY, NULL);
}
/********************************************************************\
@@ -942,7 +941,6 @@
/* ------------------------------------------------- */
/* Make sure all associated splits are in proper order
* in their accounts with the correct balances. */
- qof_event_suspend();
/* Iterate over existing splits */
slist = g_list_copy(trans->splits);
@@ -962,7 +960,7 @@
}
if (s->parent == trans) {
- /* Split was either destroyed or just changed */
+ /* Split was either added, destroyed or just changed */
if (s->inst.do_free)
qof_event_gen(&s->inst.entity, QOF_EVENT_DESTROY, NULL);
else qof_event_gen(&s->inst.entity, QOF_EVENT_MODIFY, NULL);
@@ -971,8 +969,6 @@
}
g_list_free(slist);
- qof_event_resume();
-
xaccTransWriteLog (trans, 'C');
/* Get rid of the copy we made. We won't be rolling back,
@@ -990,6 +986,7 @@
g_assert(trans->inst.editlevel == 0);
gen_event_trans (trans); //TODO: could be conditional
+ qof_event_gen (&trans->inst.entity, QOF_EVENT_MODIFY, NULL);
}
void
@@ -1093,8 +1090,7 @@
if (i < num_preexist) {
Split *so = onode->data;
- s->acc = so->acc;
- s->parent = so->parent;
+ xaccSplitRollbackEdit(s);
SWAP(s->action, so->action);
SWAP(s->memo, so->memo);
SWAP(s->inst.kvp_data, so->inst.kvp_data);
@@ -1109,13 +1105,14 @@
xaccFreeSplit(so);
} else {
/* Potentially added splits */
- trans->splits = g_list_remove(trans->splits, s);
if (trans != xaccSplitGetParent(s)) {
- /* NOOP, New split added, but then moved to another
+ trans->splits = g_list_remove(trans->splits, s);
+ /* New split added, but then moved to another
transaction */
continue;
}
xaccSplitRollbackEdit(s);
+ trans->splits = g_list_remove(trans->splits, s);
g_assert(trans != xaccSplitGetParent(s));
/* NB: our memory management policy here is that a new split
added to the transaction which is then rolled-back still
More information about the gnucash-changes
mailing list