Fix bugs.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6269 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-12-07 11:10:22 +00:00
parent 2f6272ac7f
commit ab80a5712f
4 changed files with 17 additions and 6 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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
{
@ -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);