mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
ongoing fixes
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8534 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
cb9ea67de7
commit
0eb9d7139c
@ -106,16 +106,8 @@ xaccSetAccountGroup (GNCBook *book, AccountGroup *grp)
|
|||||||
|
|
||||||
gnc_book_set_data (book, GNC_TOP_GROUP, grp);
|
gnc_book_set_data (book, GNC_TOP_GROUP, grp);
|
||||||
|
|
||||||
/* XXX Do not free the old topgroup here unless you also fix
|
xaccAccountGroupBeginEdit (old_grp);
|
||||||
* all the other uses of xaccSetAccountGroup()! That's because
|
xaccAccountGroupDestroy (old_grp);
|
||||||
* 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);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
|
@ -803,6 +803,7 @@ gnc_book_get_template_group( GNCBook *book )
|
|||||||
void
|
void
|
||||||
gnc_book_set_template_group (GNCBook *book, AccountGroup *templateGroup)
|
gnc_book_set_template_group (GNCBook *book, AccountGroup *templateGroup)
|
||||||
{
|
{
|
||||||
|
AccountGroup *old_grp;
|
||||||
if (!book) return;
|
if (!book) return;
|
||||||
|
|
||||||
if (templateGroup && templateGroup->book != book)
|
if (templateGroup && templateGroup->book != book)
|
||||||
@ -811,6 +812,12 @@ gnc_book_set_template_group (GNCBook *book, AccountGroup *templateGroup)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
old_grp = gnc_book_get_template_group (book);
|
||||||
|
if (old_grp == templateGroup) return;
|
||||||
|
|
||||||
gnc_book_set_data (book, GNC_TEMPLATE_GROUP, templateGroup);
|
gnc_book_set_data (book, GNC_TEMPLATE_GROUP, templateGroup);
|
||||||
|
|
||||||
|
xaccAccountGroupBeginEdit (old_grp);
|
||||||
|
xaccAccountGroupDestroy (old_grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,22 +169,15 @@ gnc_book_populate (GNCBook *book)
|
|||||||
static void
|
static void
|
||||||
gnc_book_depopulate (GNCBook *book)
|
gnc_book_depopulate (GNCBook *book)
|
||||||
{
|
{
|
||||||
AccountGroup *grp;
|
|
||||||
gnc_commodity_table *ct;
|
|
||||||
|
|
||||||
/* unhook the top-level group */
|
/* unhook the top-level group */
|
||||||
grp = xaccGetAccountGroup (book);
|
|
||||||
xaccAccountGroupBeginEdit (grp);
|
|
||||||
xaccAccountGroupDestroy (grp);
|
|
||||||
xaccSetAccountGroup (book, NULL);
|
xaccSetAccountGroup (book, NULL);
|
||||||
|
|
||||||
/* unhook the prices */
|
/* unhook the prices */
|
||||||
gnc_pricedb_set_db (book, NULL);
|
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_commodity_table_set_table (book, NULL);
|
||||||
|
|
||||||
|
gnc_book_set_template_group (book, NULL);
|
||||||
/* FIXME: destroy SX data members here, too */
|
/* FIXME: destroy SX data members here, too */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user