diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-02 01:55:55 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-02 01:55:55 -0400 |
commit | cda19829bd1100d6563b48ddb121f2afc1c55d95 (patch) | |
tree | 5b6ab0d1eb7ec1b0b3eccf817678d0aa9a3feb47 /src/account.cc | |
parent | 017492ef5e80003073c5d053252d4a68a44260ae (diff) | |
parent | fb7cafa8965c89bbd66b09f827bd5989a87c983b (diff) | |
download | fork-ledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.tar.gz fork-ledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.tar.bz2 fork-ledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.zip |
Merge branch 'next'
Diffstat (limited to 'src/account.cc')
-rw-r--r-- | src/account.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/account.cc b/src/account.cc index e02d21d7..8d4341e7 100644 --- a/src/account.cc +++ b/src/account.cc @@ -42,9 +42,12 @@ account_t::~account_t() { TRACE_DTOR(account_t); - foreach (accounts_map::value_type& pair, accounts) - if (! pair.second->has_flags(ACCOUNT_TEMP)) + foreach (accounts_map::value_type& pair, accounts) { + if (! pair.second->has_flags(ACCOUNT_TEMP) || + has_flags(ACCOUNT_TEMP)) { checked_delete(pair.second); + } + } } account_t * account_t::find_account(const string& name, @@ -79,6 +82,14 @@ account_t * account_t::find_account(const string& name, return NULL; account = new account_t(this, first); + + // An account created within a temporary or generated account is itself + // temporary or generated, so that the whole tree has the same status. + if (has_flags(ACCOUNT_TEMP)) + account->add_flags(ACCOUNT_TEMP); + if (has_flags(ACCOUNT_GENERATED)) + account->add_flags(ACCOUNT_GENERATED); + std::pair<accounts_map::iterator, bool> result = accounts.insert(accounts_map::value_type(first, account)); assert(result.second); |