Fixed a data lifetime bug

This was causing budget totals not to appear in balance reports.

Fixes 8254755E-7B61-47C8-B48E-A2A7FD79EB80
This commit is contained in:
John Wiegley 2009-10-27 05:23:24 -04:00
parent 6a2c6db071
commit f20b6a3b9e

View file

@ -77,8 +77,13 @@ void report_t::xact_report(post_handler_ptr handler, xact_t& xact)
void report_t::accounts_report(acct_handler_ptr handler)
{
journal_posts_iterator walker(*session.journal.get());
pass_down_posts(chain_post_handlers(*this, post_handler_ptr(new ignore_posts),
true), walker);
// The lifetime of the chain object controls the lifetime of all temporary
// objects created within it during the call to pass_down_posts, which will
// be needed later by the pass_down_accounts.
post_handler_ptr chain =
chain_post_handlers(*this, post_handler_ptr(new ignore_posts), true);
pass_down_posts(chain, walker);
scoped_ptr<accounts_iterator> iter;
if (! HANDLED(sort_)) {