gnucash maint: Bug 797901 - File History not updated

Robert Fewell bobit at code.gnucash.org
Sun Nov 15 09:38:41 EST 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/20f2efbe (commit)
	from  https://github.com/Gnucash/gnucash/commit/ea78fa55 (commit)



commit 20f2efbe1188ebb07c3610f7654d1be92d924906
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Nov 15 14:37:57 2020 +0000

    Bug 797901 - File History not updated
    
    To reproduce this, with an existing list of four recently opened files,
    open a fifth file whose name must differ from those already in the list
    and you will observe that the file history list is not updated.
    
    This was down to when doing the 'File->Open', a call is made to
    gnc_close_gui_component_by_session which closes the existing pages and
    as part of that the preference callbacks for the history plugin page
    were being removed along with some others like for tab placement.
    
    To fix this added the removal inside an if statement that checks to see
    if the window is quitting or not.

diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index d416a3e36..c88c1d234 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -1405,8 +1405,14 @@ gnc_main_window_quit(GncMainWindow *window)
     }
     if (do_shutdown)
     {
+        GList *w;
+
+        for (w = active_windows; w; w = g_list_next (w))
+        {
+            window = w->data;
+            window->window_quitting = TRUE; // set window_quitting on all windows
+        }
         /* remove the preference callbacks from the main window */
-        window->window_quitting = TRUE;
         gnc_main_window_remove_prefs (window);
         g_timeout_add(250, gnc_main_window_timed_quit, NULL);
         return TRUE;
@@ -3232,21 +3238,25 @@ gnc_main_window_close_page (GncPluginPage *page)
     priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
     if (priv->installed_pages == NULL)
     {
-        GncPluginManager *manager = gnc_plugin_manager_get ();
-        GList *plugins = gnc_plugin_manager_get_plugins (manager);
+        if (window->window_quitting)
+        {
+            GncPluginManager *manager = gnc_plugin_manager_get ();
+            GList *plugins = gnc_plugin_manager_get_plugins (manager);
 
-        /* remove only the preference callbacks from the window plugins */
-        window->just_plugin_prefs = TRUE;
-        g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
-        window->just_plugin_prefs = FALSE;
-        g_list_free (plugins);
+            /* remove only the preference callbacks from the window plugins */
+            window->just_plugin_prefs = TRUE;
+            g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
+            window->just_plugin_prefs = FALSE;
+            g_list_free (plugins);
 
-        /* remove the preference callbacks from the main window */
-        gnc_main_window_remove_prefs (window);
+            /* remove the preference callbacks from the main window */
+            gnc_main_window_remove_prefs (window);
 
-        if (g_list_length(active_windows) > 1)
+            gtk_widget_destroy (GTK_WIDGET(window));
+        }
+        if (g_list_length (active_windows) > 1)
         {
-            gtk_widget_destroy(GTK_WIDGET(window));
+            gtk_widget_destroy (GTK_WIDGET(window));
         }
     }
 }



Summary of changes:
 gnucash/gnome-utils/gnc-main-window.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)



More information about the gnucash-changes mailing list