diff --git a/src/backend/file/io-gncbin-r.c b/src/backend/file/io-gncbin-r.c index 0907f0282c..cc9c25b97d 100644 --- a/src/backend/file/io-gncbin-r.c +++ b/src/backend/file/io-gncbin-r.c @@ -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. */ diff --git a/src/backend/file/io-gncxml-v1.c b/src/backend/file/io-gncxml-v1.c index b7bf8c3090..b5520ecd0b 100644 --- a/src/backend/file/io-gncxml-v1.c +++ b/src/backend/file/io-gncxml-v1.c @@ -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) + { + if(!global_parse_status.account_group) return FALSE; - { - AccountGroup *g = gnc_book_get_group(book); - - 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));