From f20b6a3b9edc2ace7b85eb4c961d57f69d98ea09 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 27 Oct 2009 05:23:24 -0400 Subject: Fixed a data lifetime bug This was causing budget totals not to appear in balance reports. Fixes 8254755E-7B61-47C8-B48E-A2A7FD79EB80 --- src/report.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/report.cc b/src/report.cc index 53426f39..6fc7626f 100644 --- a/src/report.cc +++ b/src/report.cc @@ -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 iter; if (! HANDLED(sort_)) { -- cgit v1.2.3