gnucash stable: Bug 799370 - Transaction Journal view cursor placement after commit to...

John Ralls jralls at code.gnucash.org
Mon Jul 15 15:23:50 EDT 2024


Updated	 via  https://github.com/Gnucash/gnucash/commit/5fe7a09e (commit)
	from  https://github.com/Gnucash/gnucash/commit/d14d11f9 (commit)



commit 5fe7a09e7d2e4a4d96a7dd916f9c50f02c19b7a4
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jul 15 11:42:29 2024 -0700

    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.

diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index d190249578..d51f348b1f 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 43d28c6e96..2db6f0bc8a 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 816269e500..a910dca1ab 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 09fb66176b..8a5abc250f 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;



Summary of changes:
 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(-)



More information about the gnucash-changes mailing list