From 5fe7a09e7d2e4a4d96a7dd916f9c50f02c19b7a4 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 15 Jul 2024 11:42:29 -0700 Subject: [PATCH] Bug 799370 - Transaction Journal view cursor placement after commit to... transaction change. This also reverts commit 60ccca017 and fixes Bug 799347 in a different way that avoids the problems found during the investigation of 799370 and reported on gnucash-user. --- gnucash/gnome-utils/gnc-tree-model-account.c | 10 ++++------ gnucash/gnome/gnc-plugin-page-account-tree.cpp | 3 +++ gnucash/register/register-gnome/combocell-gnome.c | 2 ++ libgnucash/engine/Account.cpp | 6 ++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c index d1902495786..d51f348b1f5 100644 --- a/gnucash/gnome-utils/gnc-tree-model-account.c +++ b/gnucash/gnome-utils/gnc-tree-model-account.c @@ -1429,11 +1429,6 @@ gnc_tree_model_account_event_handler (QofInstance *entity, return; } - /* clear the cached model values for account */ - if (event_type != QOF_EVENT_ADD) - gnc_tree_model_account_clear_cached_values (model, account); - - /* What to do, that to do. */ switch (event_type) { case QOF_EVENT_ADD: @@ -1475,7 +1470,10 @@ gnc_tree_model_account_event_handler (QofInstance *entity, case QOF_EVENT_MODIFY: DEBUG("modify account %p (%s)", account, xaccAccountGetName (account)); - path = gnc_tree_model_account_get_path_from_account (model, account); + /* clear the cached model values for account */ + gnc_tree_model_account_clear_cached_values(model, account); + + path = gnc_tree_model_account_get_path_from_account(model, account); if (!path) { DEBUG("can't generate path"); diff --git a/gnucash/gnome/gnc-plugin-page-account-tree.cpp b/gnucash/gnome/gnc-plugin-page-account-tree.cpp index 43d28c6e96f..2db6f0bc8ab 100644 --- a/gnucash/gnome/gnc-plugin-page-account-tree.cpp +++ b/gnucash/gnome/gnc-plugin-page-account-tree.cpp @@ -1510,6 +1510,9 @@ gnc_plugin_page_account_tree_cmd_delete_account (GSimpleAction *simple, if (account == NULL) return; + if (!gnc_main_window_all_finish_pending()) + return; + memset (&adopt, 0, sizeof (adopt)); /* If the account has objects referring to it, show the list - the account can't be deleted until these references are dealt with. */ diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c index 816269e5005..a910dca1ab1 100644 --- a/gnucash/register/register-gnome/combocell-gnome.c +++ b/gnucash/register/register-gnome/combocell-gnome.c @@ -916,6 +916,8 @@ gnc_combo_cell_gui_move (BasicCell* bcell) gnc_item_edit_set_popup (box->item_edit, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + gnc_item_list_select (box->item_list, NULL); + box->list_popped = FALSE; } diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp index 09fb66176b9..8a5abc250f6 100644 --- a/libgnucash/engine/Account.cpp +++ b/libgnucash/engine/Account.cpp @@ -2871,13 +2871,11 @@ gnc_account_remove_child (Account *parent, Account *child) ed.node = parent; ed.idx = gnc_account_child_index (parent, child); - // First send the event before we invalidate everything in children. - qof_event_gen(&child->inst, QOF_EVENT_REMOVE, &ed); - - // Then remove the child and release its memory. ppriv->children.erase (std::remove (ppriv->children.begin(), ppriv->children.end(), child), ppriv->children.end()); + /* Now send the event. */ + qof_event_gen(&child->inst, QOF_EVENT_REMOVE, &ed); /* clear the account's parent pointer after REMOVE event generation. */ cpriv->parent = nullptr;