From f1dd8cfaf13395e8fe44768211a76a98fe358e1f Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Wed, 21 Mar 2018 12:28:34 +0000 Subject: [PATCH] Component not found error when accounts are deleted When accounts are deleted that have an open register window a component not found error is triggered. After the account is destroyed, a call to 'gnc_resume_gui_refresh' calls 'gnc_gui_refresh_internal' and this then calls 'find_component_ids_by_class' which is used in order resulting in 'register-single' being unregistered before 'GncPluginPageRegister' and hence 'ld' being freed but the register not knowing this. Reversing the list fixes this. --- gnucash/register/ledger-core/gnc-ledger-display.c | 1 + libgnucash/app-utils/gnc-component-manager.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/gnucash/register/ledger-core/gnc-ledger-display.c b/gnucash/register/ledger-core/gnc-ledger-display.c index ea390ee1e1..c84c1f7cd7 100644 --- a/gnucash/register/ledger-core/gnc-ledger-display.c +++ b/gnucash/register/ledger-core/gnc-ledger-display.c @@ -594,6 +594,7 @@ close_handler (gpointer user_data) return; gnc_unregister_gui_component (ld->component_id); + ld->component_id = NO_COMPONENT; if (ld->destroy) ld->destroy (ld); diff --git a/libgnucash/app-utils/gnc-component-manager.c b/libgnucash/app-utils/gnc-component-manager.c index e788b48995..c32be015df 100644 --- a/libgnucash/app-utils/gnc-component-manager.c +++ b/libgnucash/app-utils/gnc-component-manager.c @@ -690,6 +690,8 @@ gnc_gui_refresh_internal (gboolean force) #endif list = find_component_ids_by_class (NULL); + // reverse the list so class GncPluginPageRegister is before register-single + list = g_list_reverse (list); for (node = list; node; node = node->next) {