From b7233edd8a7101c16d41837a8ebe2710ede76cc7 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 28 Oct 2009 01:15:57 -0400 Subject: Added some additional assertion tests re: temps --- src/xact.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/xact.cc') 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); } -- cgit v1.2.3