diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-31 04:28:58 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-31 04:28:58 -0400 |
commit | 8276b51f5692796bfdf75dd64f709e0de1c7caaf (patch) | |
tree | 8f2a964080d2ee7e90400e158d3f89e9ffdbfa75 /entry.cc | |
parent | 208c414ab9600eca4852034a923418948629ced0 (diff) | |
download | ledger-8276b51f5692796bfdf75dd64f709e0de1c7caaf.tar.gz ledger-8276b51f5692796bfdf75dd64f709e0de1c7caaf.tar.bz2 ledger-8276b51f5692796bfdf75dd64f709e0de1c7caaf.zip |
A new binary_cache_t object has been creating to manage saving and restoring a
Ledger session from a cache file. It doesn't work at all yet, though at least
the major structures are in place now.
Diffstat (limited to 'entry.cc')
-rw-r--r-- | entry.cc | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -36,7 +36,8 @@ namespace ledger { entry_base_t::entry_base_t(const entry_base_t& e) - : journal(NULL), beg_pos(0), beg_line(0), end_pos(0), end_line(0) + : supports_flags<>(), journal(NULL), + beg_pos(0), beg_line(0), end_pos(0), end_line(0) { TRACE_CTOR(entry_base_t, "copy"); @@ -53,10 +54,15 @@ entry_base_t::~entry_base_t() for (xacts_list::iterator i = xacts.begin(); i != xacts.end(); i++) - if (! (*i)->has_flags(XACT_BULK_ALLOC)) - checked_delete(*i); - else - (*i)->~xact_t(); + // If the transaction is a temporary, it will be destructed when the + // temporary is. If it's from a binary cache, we can safely destruct it + // but its memory will be deallocated with the cache. + if (! (*i)->has_flags(XACT_TEMP)) { + if (! (*i)->has_flags(XACT_IN_CACHE)) + checked_delete(*i); + else + (*i)->~xact_t(); + } } void entry_base_t::add_xact(xact_t * xact) |