r15763 - gnucash/branches/2.0 - Fix crash if OB setup druid gets closed while waiting for the wizard. #409319.

Derek Atkins warlord at cvs.gnucash.org
Fri Mar 30 17:55:30 EDT 2007


Author: warlord
Date: 2007-03-30 17:55:29 -0400 (Fri, 30 Mar 2007)
New Revision: 15763
Trac: http://svn.gnucash.org/trac/changeset/15763

Modified:
   gnucash/branches/2.0/
   gnucash/branches/2.0/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.

Merge from r15623.



Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14163
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14348
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282

Modified: gnucash/branches/2.0/src/import-export/hbci/druid-hbci-initial.c
===================================================================
--- gnucash/branches/2.0/src/import-export/hbci/druid-hbci-initial.c	2007-03-30 14:02:33 UTC (rev 15762)
+++ gnucash/branches/2.0/src/import-export/hbci/druid-hbci-initial.c	2007-03-30 21:55:29 UTC (rev 15763)
@@ -75,6 +75,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 gboolean
 hash_remove (gpointer key, gpointer value, gpointer user_data) 
 {
@@ -90,6 +95,7 @@
     g_hash_table_destroy (hash);
   }
 }
+
 static void
 reset_initial_info (HBCIInitialInfo *info)
 {
@@ -120,6 +126,7 @@
   if (info->window != NULL) 
     gtk_widget_destroy (info->window);
 
+  hbci_druid_is_active = FALSE;
   g_free (info);
 }
 
@@ -572,6 +579,7 @@
 	res = 0;
 	/* wait until child is finished */
 	while (wait_result == 0) {
+	  hbci_druid_is_active = TRUE;
 	  gtk_main_iteration();
 	  wait_result = waitpid(pid, &wait_status, WNOHANG);
 	  if ((wait_result == pid) && WIFEXITED(wait_status))
@@ -579,6 +587,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