From 46302362dda509bb7c6f10f5ea059ba51d1f0aba Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 9 Feb 2005 05:06:27 +0000 Subject: (related_transactions::flush): Handle the case where an auto_entry or period_entry passes through the related_transactions handler. --- walk.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/walk.cc b/walk.cc index bf1e9186..a01cb185 100644 --- a/walk.cc +++ b/walk.cc @@ -210,22 +210,35 @@ void collapse_transactions::operator()(transaction_t& xact) void related_transactions::flush() { - if (transactions.size() > 0) + if (transactions.size() > 0) { for (transactions_list::iterator i = transactions.begin(); i != transactions.end(); - i++) - for (transactions_list::iterator j = (*i)->entry->transactions.begin(); - j != (*i)->entry->transactions.end(); - j++) { - transaction_xdata_t& xdata = transaction_xdata(**j); + i++) { + if ((*i)->entry) { + for (transactions_list::iterator j = (*i)->entry->transactions.begin(); + j != (*i)->entry->transactions.end(); + j++) { + transaction_xdata_t& xdata = transaction_xdata(**j); + if (! (xdata.dflags & TRANSACTION_HANDLED) && + (! (xdata.dflags & TRANSACTION_RECEIVED) ? + ! ((*j)->flags & (TRANSACTION_AUTO | TRANSACTION_VIRTUAL)) : + also_matching)) { + xdata.dflags |= TRANSACTION_HANDLED; + item_handler::operator()(**j); + } + } + } else { + transaction_xdata_t& xdata = transaction_xdata(**i); if (! (xdata.dflags & TRANSACTION_HANDLED) && (! (xdata.dflags & TRANSACTION_RECEIVED) ? - ! ((*j)->flags & (TRANSACTION_AUTO | TRANSACTION_VIRTUAL)) : + ! ((*i)->flags & (TRANSACTION_AUTO | TRANSACTION_VIRTUAL)) : also_matching)) { xdata.dflags |= TRANSACTION_HANDLED; - item_handler::operator()(**j); + item_handler::operator()(**i); } } + } + } item_handler::flush(); } -- cgit v1.2.3