ongoing fixes

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8534 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-06-10 04:38:10 +00:00
parent cb9ea67de7
commit 0eb9d7139c
3 changed files with 10 additions and 18 deletions

View File

@ -106,16 +106,8 @@ xaccSetAccountGroup (GNCBook *book, AccountGroup *grp)
gnc_book_set_data (book, GNC_TOP_GROUP, grp);
/* XXX Do not free the old topgroup here unless you also fix
* all the other uses of xaccSetAccountGroup()! That's because
* the account group is not reference-counted, and there's some
* chance that we'll leave a dangling pointer somewhere.
*/
/*
xaccAccountGroupBeginEdit (old_grp);
xaccAccountGroupDestroy (old_grp);
*/
}
/********************************************************************\

View File

@ -803,6 +803,7 @@ gnc_book_get_template_group( GNCBook *book )
void
gnc_book_set_template_group (GNCBook *book, AccountGroup *templateGroup)
{
AccountGroup *old_grp;
if (!book) return;
if (templateGroup && templateGroup->book != book)
@ -811,6 +812,12 @@ gnc_book_set_template_group (GNCBook *book, AccountGroup *templateGroup)
return;
}
old_grp = gnc_book_get_template_group (book);
if (old_grp == templateGroup) return;
gnc_book_set_data (book, GNC_TEMPLATE_GROUP, templateGroup);
xaccAccountGroupBeginEdit (old_grp);
xaccAccountGroupDestroy (old_grp);
}

View File

@ -169,22 +169,15 @@ gnc_book_populate (GNCBook *book)
static void
gnc_book_depopulate (GNCBook *book)
{
AccountGroup *grp;
gnc_commodity_table *ct;
/* unhook the top-level group */
grp = xaccGetAccountGroup (book);
xaccAccountGroupBeginEdit (grp);
xaccAccountGroupDestroy (grp);
xaccSetAccountGroup (book, NULL);
/* unhook the prices */
gnc_pricedb_set_db (book, NULL);
ct = gnc_commodity_table_get_table (book);
gnc_commodity_table_destroy (ct);
gnc_commodity_table_set_table (book, NULL);
gnc_book_set_template_group (book, NULL);
/* FIXME: destroy SX data members here, too */
}