summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/account.cc4
-rw-r--r--src/xact.cc15
2 files changed, 14 insertions, 5 deletions
diff --git a/src/account.cc b/src/account.cc
index 4bcb0c25..57b66d86 100644
--- a/src/account.cc
+++ b/src/account.cc
@@ -42,8 +42,10 @@ account_t::~account_t()
{
TRACE_DTOR(account_t);
- foreach (accounts_map::value_type& pair, accounts)
+ foreach (accounts_map::value_type& pair, accounts) {
+ assert(! pair.second->has_flags(ACCOUNT_TEMP));
checked_delete(pair.second);
+ }
}
account_t * account_t::find_account(const string& name,
diff --git a/src/xact.cc b/src/xact.cc
index 6ea8d8f9..9f118ec2 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -49,16 +49,23 @@ xact_base_t::~xact_base_t()
{
TRACE_DTOR(xact_base_t);
- foreach (post_t * post, posts) {
- // If the posting is a temporary, it will be destructed when the
- // temporary is.
- if (! post->has_flags(ITEM_TEMP))
+ if (! has_flags(ITEM_TEMP)) {
+ foreach (post_t * post, posts) {
+ // If the posting is a temporary, it will be destructed when the
+ // temporary is.
+ assert(! post->has_flags(ITEM_TEMP));
checked_delete(post);
+ }
}
}
void xact_base_t::add_post(post_t * post)
{
+ // You can add temporary postings to transactions, but not real postings to
+ // temporary transactions.
+ if (! post->has_flags(ITEM_TEMP))
+ assert(! has_flags(ITEM_TEMP));
+
posts.push_back(post);
}