mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[account.cpp] gnc_account_remove_split searches from the end
because removing the latest split is far more common (e.g. from ui or during book shutdown) than removing an early split.
This commit is contained in:
parent
2d030c5af1
commit
5aff4fb57d
@ -2002,8 +2002,11 @@ gnc_account_remove_split (Account *acc, Split *s)
|
||||
|
||||
if (!g_hash_table_remove (priv->splits_hash, s))
|
||||
return false;
|
||||
auto it = std::remove (priv->splits.begin(), priv->splits.end(), s);
|
||||
priv->splits.erase (it, priv->splits.end());
|
||||
|
||||
// search splits in reverse, because removing the latest split is
|
||||
// more common (e.g. from UI or during book shutdown)
|
||||
auto rit = std::remove(priv->splits.rbegin(), priv->splits.rend(), s);
|
||||
priv->splits.erase(rit.base(), priv->splits.end());
|
||||
//FIXME: find better event type
|
||||
qof_event_gen(&acc->inst, QOF_EVENT_MODIFY, nullptr);
|
||||
// And send the account-based event, too
|
||||
|
Loading…
Reference in New Issue
Block a user