r15674 - gnucash/trunk/src - Destroy no longer used template accounts when reading scheduled
David Hampton
hampton at cvs.gnucash.org
Tue Feb 27 23:42:45 EST 2007
Author: hampton
Date: 2007-02-27 23:42:44 -0500 (Tue, 27 Feb 2007)
New Revision: 15674
Trac: http://svn.gnucash.org/trac/changeset/15674
Modified:
gnucash/trunk/src/backend/file/gnc-schedxaction-xml-v2.c
gnucash/trunk/src/engine/SchedXaction.c
gnucash/trunk/src/engine/SchedXaction.h
Log:
Destroy no longer used template accounts when reading scheduled
transactions from a file. Fixes #412673.
Modified: gnucash/trunk/src/backend/file/gnc-schedxaction-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-schedxaction-xml-v2.c 2007-02-27 14:37:11 UTC (rev 15673)
+++ gnucash/trunk/src/backend/file/gnc-schedxaction-xml-v2.c 2007-02-28 04:42:44 UTC (rev 15674)
@@ -615,13 +615,15 @@
struct sx_pdata *pdata = sx_pdata;
SchedXaction *sx = pdata->sx;
GUID *templ_acct_guid = dom_tree_to_guid(node);
+ Account *account;
if (!templ_acct_guid)
{
return FALSE;
}
- sx->template_acct = xaccAccountLookup(templ_acct_guid, pdata->book);
+ account = xaccAccountLookup(templ_acct_guid, pdata->book);
+ sx_set_template_account(sx, account);
g_free(templ_acct_guid);
return TRUE;
Modified: gnucash/trunk/src/engine/SchedXaction.c
===================================================================
--- gnucash/trunk/src/engine/SchedXaction.c 2007-02-27 14:37:11 UTC (rev 15673)
+++ gnucash/trunk/src/engine/SchedXaction.c 2007-02-28 04:42:44 UTC (rev 15674)
@@ -138,7 +138,21 @@
return;
}
+
void
+sx_set_template_account (SchedXaction *sx, Account *account)
+{
+ Account *old;
+
+ old = sx->template_acct;
+ sx->template_acct = account;
+ if (old) {
+ xaccAccountBeginEdit(old);
+ xaccAccountDestroy(old);
+ }
+}
+
+void
xaccSchedXactionFree( SchedXaction *sx )
{
GList *l;
Modified: gnucash/trunk/src/engine/SchedXaction.h
===================================================================
--- gnucash/trunk/src/engine/SchedXaction.h 2007-02-27 14:37:11 UTC (rev 15673)
+++ gnucash/trunk/src/engine/SchedXaction.h 2007-02-28 04:42:44 UTC (rev 15674)
@@ -118,6 +118,8 @@
*/
SchedXaction *xaccSchedXactionMalloc(QofBook *book);
+void sx_set_template_account (SchedXaction *sx, Account *account);
+
/**
* Cleans up and frees a SchedXaction and it's associated data.
*/
More information about the gnucash-changes
mailing list