AUDIT: r15623 - gnucash/trunk/src/import-export/hbci - Fix crash if OB setup druid gets closed while waiting for the wizard. #409319.

Andreas Köhler andi5 at cvs.gnucash.org
Mon Feb 19 12:41:43 EST 2007


Author: andi5
Date: 2007-02-19 12:41:41 -0500 (Mon, 19 Feb 2007)
New Revision: 15623
Trac: http://svn.gnucash.org/trac/changeset/15623

Modified:
   gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
Log:
Fix crash if OB setup druid gets closed while waiting for the wizard.  #409319.

In the online banking setup druid the process is forked for executing
the AqBanking Qt wizard. While waiting for it, the user can cancel the
druid in an inner main loop, but the code once returned does not know
that and crashes. Patch by cstim.

BP


Modified: gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c	2007-02-19 08:35:54 UTC (rev 15622)
+++ gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c	2007-02-19 17:41:41 UTC (rev 15623)
@@ -87,6 +87,11 @@
 
 };
 
+/* Is TRUE as long as the druid is opened and running. Is being
+   used to catch a window close event during waiting for a child
+   process. */
+static gboolean hbci_druid_is_active = FALSE;
+
 static void
 reset_initial_info (HBCIInitialInfo *info)
 {
@@ -115,6 +120,7 @@
   if (info->window != NULL) 
     gtk_widget_destroy (info->window);
 
+  hbci_druid_is_active = FALSE;
   g_free (info);
 }
 
@@ -585,6 +591,7 @@
       default: /* parent */
 	res = 0;
 	/* wait until child is finished */
+	hbci_druid_is_active = TRUE;
 	while (wait_result == 0) {
 	  gtk_main_iteration();
 	  wait_result = waitpid(pid, &wait_status, WNOHANG);
@@ -593,6 +600,12 @@
 	  else
 	    res = -8;
 	}
+	if (!hbci_druid_is_active) {
+	  /* Just in case the druid has been canceled in the meantime. */
+	  g_free (backend_name);
+	  GWEN_Buffer_free(buf);
+	  return;
+	}
 	AB_Banking_Init (info->api);
       }
     }



More information about the gnucash-changes mailing list