gnucash maint: Bug 796474 - Segmentation fault while setting up online banking

John Ralls jralls at code.gnucash.org
Sat Jul 7 15:36:08 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/eb0256e3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/9d5712ef (commit)



commit eb0256e3e7e311cfc2ddb8d09343ebefa0405e44
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Jul 7 12:34:47 2018 -0700

    Bug 796474 - Segmentation fault while setting up online banking
    
    Allow only a single instance of the assistant.

diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
index 920a58d..4ce2bc2 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.c
+++ b/gnucash/import-export/aqb/assistant-ab-initial.c
@@ -90,6 +90,8 @@ void aai_match_page_prepare (GtkAssistant *assistant, gpointer user_data);
 
 static gboolean banking_has_accounts(AB_BANKING *banking);
 static void hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data);
+static ABInitialInfo *single_info = NULL;
+
 #if AQBANKING_VERSION_INT <= 49908
 static void child_exit_cb(GPid pid, gint status, gpointer data);
 #endif
@@ -178,6 +180,7 @@ void
 aai_destroy_cb(GtkWidget *object, gpointer user_data)
 {
     ABInitialInfo *info = user_data;
+    g_return_if_fail (single_info && info == single_info);
 
     gnc_unregister_gui_component_by_data(ASSISTANT_AB_INITIAL_CM_CLASS, info);
 
@@ -211,6 +214,7 @@ aai_destroy_cb(GtkWidget *object, gpointer user_data)
     info->window = NULL;
 
     g_free(info);
+    single_info = NULL;
 }
 
 void
@@ -845,16 +849,15 @@ void aai_on_prepare (GtkAssistant  *assistant, GtkWidget *page,
     }
 }
 
-void
-gnc_ab_initial_assistant(void)
+static ABInitialInfo *
+gnc_ab_initial_assistant_new(void)
 {
-    ABInitialInfo *info;
     GtkBuilder *builder;
     GtkTreeViewColumn *column;
     GtkTreeSelection *selection;
     gint component_id;
 
-    info = g_new0(ABInitialInfo, 1);
+    ABInitialInfo *info = g_new0(ABInitialInfo, 1);
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "assistant-ab-initial.glade", "aqbanking_init_assistant");
 
@@ -910,6 +913,14 @@ gnc_ab_initial_assistant(void)
                    NULL, aai_close_handler, info);
 
     gnc_gui_component_set_session(component_id, gnc_get_current_session());
+    return info;
+}
 
-    gtk_widget_show(info->window);
+void
+gnc_ab_initial_assistant(void)
+{
+    if (!single_info)
+        single_info = gnc_ab_initial_assistant_new();
+    gtk_widget_show(single_info->window);
 }
+



Summary of changes:
 gnucash/import-export/aqb/assistant-ab-initial.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list