mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
fix memory management relating to starage of group in book
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8530 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ebcd1819b1
commit
1045811746
@ -520,11 +520,7 @@ gnc_load_financials_from_fd(GNCBook *book, int fd)
|
||||
|
||||
xaccLogEnable();
|
||||
|
||||
{
|
||||
AccountGroup *g = gnc_book_get_group(book);
|
||||
gnc_book_set_group(book, grp);
|
||||
if (g) xaccFreeAccountGroup(g);
|
||||
}
|
||||
xaccSetAccountGroup(book, grp);
|
||||
|
||||
/* mark the newly read book as saved, since the act of putting it
|
||||
* together will have caused it to be marked up as not-saved. */
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "gnc-xml-helper.h"
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
#include "Group.h"
|
||||
#include "GroupP.h"
|
||||
#include "Query.h"
|
||||
#include "QueryP.h"
|
||||
#include "Scrub.h"
|
||||
@ -387,30 +389,16 @@ gnc_session_load_from_xml_file(GNCSession *session)
|
||||
|
||||
sixtp_destroy(top_level_pr);
|
||||
|
||||
if(parse_ok) {
|
||||
if(!global_parse_status.account_group)
|
||||
return FALSE;
|
||||
|
||||
if(parse_ok)
|
||||
{
|
||||
AccountGroup *g = gnc_book_get_group(book);
|
||||
if(!global_parse_status.account_group) return FALSE;
|
||||
|
||||
gnc_book_set_group(book, global_parse_status.account_group);
|
||||
|
||||
if(g)
|
||||
{
|
||||
xaccAccountGroupBeginEdit(g);
|
||||
xaccAccountGroupDestroy(g);
|
||||
}
|
||||
}
|
||||
xaccSetAccountGroup(book, global_parse_status.account_group);
|
||||
|
||||
if(global_parse_status.pricedb)
|
||||
{
|
||||
gnc_pricedb_set_db(book, global_parse_status.pricedb);
|
||||
}
|
||||
else
|
||||
{
|
||||
gnc_pricedb_set_db(book, gnc_pricedb_create(book));
|
||||
}
|
||||
|
||||
/* Fix account and transaction commodities */
|
||||
xaccGroupScrubCommodities (gnc_book_get_group(book));
|
||||
|
Loading…
Reference in New Issue
Block a user