r15257 - gnucash/branches/remove-group2/src/engine - Protect against setting an existing tree node as the new root of the
David Hampton
hampton at cvs.gnucash.org
Mon Dec 25 15:18:37 EST 2006
Author: hampton
Date: 2006-12-25 15:18:36 -0500 (Mon, 25 Dec 2006)
New Revision: 15257
Trac: http://svn.gnucash.org/trac/changeset/15257
Modified:
gnucash/branches/remove-group2/src/engine/Account.c
Log:
Protect against setting an existing tree node as the new root of the
tree.
Modified: gnucash/branches/remove-group2/src/engine/Account.c
===================================================================
--- gnucash/branches/remove-group2/src/engine/Account.c 2006-12-25 18:53:05 UTC (rev 15256)
+++ gnucash/branches/remove-group2/src/engine/Account.c 2006-12-25 20:18:36 UTC (rev 15257)
@@ -168,6 +168,15 @@
old_root = gnc_coll_get_root_account (col);
if (old_root == root) return;
+ /* If the new root is already linked into the tree somewhere, then
+ * remove it from its current position before adding it at the
+ * top. */
+ if (root->parent) {
+ xaccAccountBeginEdit(root);
+ gnc_account_remove_child(root->parent, root);
+ xaccAccountCommitEdit(root);
+ }
+
qof_collection_set_data (col, root);
if (old_root) {
More information about the gnucash-changes
mailing list