gnucash stable: Revert "[account.cpp] gnc_account_remove_split searches from the end"

Christopher Lam clam at code.gnucash.org
Tue May 21 10:58:27 EDT 2024


Updated	 via  https://github.com/Gnucash/gnucash/commit/038405b3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/5aff4fb5 (commit)



commit 038405b3700aca653f04fb4f2179f22266146262
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue May 21 22:57:41 2024 +0800

    Revert "[account.cpp] gnc_account_remove_split searches from the end"
    
    This reverts commit 5aff4fb57d7c9723676f02d4ae9a0ac47bcdf442. Was not
    tested properly...

diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp
index 294dfef09a..e82fb8d9c0 100644
--- a/libgnucash/engine/Account.cpp
+++ b/libgnucash/engine/Account.cpp
@@ -2002,11 +2002,8 @@ gnc_account_remove_split (Account *acc, Split *s)
 
     if (!g_hash_table_remove (priv->splits_hash, s))
         return false;
-
-    // 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());
+    auto it = std::remove (priv->splits.begin(), priv->splits.end(), s);
+    priv->splits.erase (it, priv->splits.end());
     //FIXME: find better event type
     qof_event_gen(&acc->inst, QOF_EVENT_MODIFY, nullptr);
     // And send the account-based event, too



Summary of changes:
 libgnucash/engine/Account.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list