Added some additional assertion tests re: temps
This commit is contained in:
parent
ade0a8b6f3
commit
b7233edd8a
2 changed files with 14 additions and 5 deletions
|
|
@ -42,8 +42,10 @@ account_t::~account_t()
|
||||||
{
|
{
|
||||||
TRACE_DTOR(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);
|
checked_delete(pair.second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
account_t * account_t::find_account(const string& name,
|
account_t * account_t::find_account(const string& name,
|
||||||
|
|
|
||||||
|
|
@ -49,16 +49,23 @@ xact_base_t::~xact_base_t()
|
||||||
{
|
{
|
||||||
TRACE_DTOR(xact_base_t);
|
TRACE_DTOR(xact_base_t);
|
||||||
|
|
||||||
|
if (! has_flags(ITEM_TEMP)) {
|
||||||
foreach (post_t * post, posts) {
|
foreach (post_t * post, posts) {
|
||||||
// If the posting is a temporary, it will be destructed when the
|
// If the posting is a temporary, it will be destructed when the
|
||||||
// temporary is.
|
// temporary is.
|
||||||
if (! post->has_flags(ITEM_TEMP))
|
assert(! post->has_flags(ITEM_TEMP));
|
||||||
checked_delete(post);
|
checked_delete(post);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void xact_base_t::add_post(post_t * 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);
|
posts.push_back(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue