Skip to content

Commit

Permalink
Fix bugs.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6269 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
jdavisp3 committed Dec 7, 2001
1 parent 2f6272a commit ab80a57
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/engine/Account.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,12 @@ xaccFreeAccount (Account *acc)

if (acc->children)
{
PERR (" xinstead of calling xaccFreeAccount(), please call \n"
PERR (" instead of calling xaccFreeAccount(), please call \n"
" xaccAccountBeginEdit(); xaccAccountDestroy(); \n");
/* First, recursively free children */
xaccFreeAccountGroup (acc->children);
acc->children = NULL;

/* First, recursively free children */
xaccFreeAccountGroup (acc->children);
acc->children = NULL;
}

/* Next, clean up the splits */
Expand Down
9 changes: 9 additions & 0 deletions src/engine/Group.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,18 @@ xaccFreeAccountGroup (AccountGroup *grp)
while (grp->accounts->next)
{
account = grp->accounts->next->data;

/* FIXME: this and the same code below is kind of hacky.
* actually, all this code seems to assume that
* the account edit levels are all 1. */
if (account->editlevel == 0)
xaccAccountBeginEdit (account);

xaccAccountDestroy (account);
}
account = grp->accounts->data;
if (account->editlevel == 0)
xaccAccountBeginEdit (account);
xaccAccountDestroy (account);

if (!root_grp) return;
Expand Down
1 change: 1 addition & 0 deletions src/engine/Transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ xaccDupeSplit (Split *s)
split->book = s->book;

split->parent = s->parent;
split->acc = s->acc;

split->memo = g_cache_insert (gnc_engine_get_string_cache(), s->memo);
split->action = g_cache_insert (gnc_engine_get_string_cache(), s->action);
Expand Down
3 changes: 2 additions & 1 deletion src/engine/test-core/test-engine-stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ make_random_changes_to_group (GNCBook *book, AccountGroup *group)
/* Add a new account */
new_account = get_random_account (book);

if (get_random_boolean ())
if (get_random_boolean () || !accounts)
xaccGroupInsertAccount (group, new_account);
else
{
Expand Down Expand Up @@ -784,6 +784,7 @@ make_random_changes_to_group (GNCBook *book, AccountGroup *group)
accounts = xaccGroupGetSubAccounts (group);

/* move some accounts around */
if (accounts && (g_list_length (accounts) > 1))
{
int i = get_random_int_in_range (1, 4);

Expand Down

0 comments on commit ab80a57

Please sign in to comment.