summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-12 05:47:32 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-12 05:48:10 -0500
commitcf67fcbd0628e03ac2f788da6f2c082121faf21f (patch)
tree155ef14f18cce506f343fb4b9d915ed0736590e4 /src/report.cc
parented42a7ebfef0374fb19ae3ecf4fe1f317bb7fd37 (diff)
downloadfork-ledger-cf67fcbd0628e03ac2f788da6f2c082121faf21f.tar.gz
fork-ledger-cf67fcbd0628e03ac2f788da6f2c082121faf21f.tar.bz2
fork-ledger-cf67fcbd0628e03ac2f788da6f2c082121faf21f.zip
Resolved a huge performance issue with 'pricedb'
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/report.cc b/src/report.cc
index 1adbe9d0..c4f916d7 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -469,8 +469,20 @@ void report_t::commodities_report(post_handler_ptr handler)
{
handler = chain_handlers(handler, *this);
- posts_commodities_iterator walker(*session.journal.get());
- pass_down_posts<posts_commodities_iterator>(handler, walker);
+ posts_commodities_iterator * walker(new posts_commodities_iterator(*session.journal.get()));
+ try {
+ pass_down_posts<posts_commodities_iterator>(handler, *walker);
+ }
+ catch (...) {
+#if defined(VERIFY_ON)
+ IF_VERIFY() {
+ // If --verify was used, clean up the posts_commodities_iterator.
+ // Otherwise, just leak like a sieve.
+ checked_delete(walker);
+ }
+#endif
+ throw;
+ }
session.journal->clear_xdata();
}