r19465 - gnucash/trunk/src/import-export/aqbanking - Add aqbanking5 extensions of GWEN_GUI object.

Christian Stimming cstim at code.gnucash.org
Sun Aug 22 16:48:55 EDT 2010


Author: cstim
Date: 2010-08-22 16:48:55 -0400 (Sun, 22 Aug 2010)
New Revision: 19465
Trac: http://svn.gnucash.org/trac/changeset/19465

Modified:
   gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c
Log:
Add aqbanking5 extensions of GWEN_GUI object.

We need to locally store a reference to that particular GWEN_GUI
object that was used in Extend because we have more than one such
object in use inside gnucash (currently). If accidentally the wrong
one would be used in Unextend, a crash occurs.

Modified: gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c	2010-08-22 19:13:00 UTC (rev 19464)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c	2010-08-22 20:48:55 UTC (rev 19465)
@@ -47,6 +47,10 @@
 #include "import-utilities.h"
 #include "qof.h"
 
+#ifdef AQBANKING_VERSION_5_PLUS
+# include <aqbanking/abgui.h>
+#endif /* AQBANKING_VERSION_5_PLUS */
+
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = G_LOG_DOMAIN;
 
@@ -114,6 +118,8 @@
     GWEN_Fini();
 }
 
+static GWEN_GUI *gnc_gwengui_extended_by_ABBanking;
+
 AB_BANKING *
 gnc_AB_BANKING_new(void)
 {
@@ -180,6 +186,11 @@
         /* Init the API */
         g_return_val_if_fail(AB_Banking_Init(api) == 0, NULL);
 
+#ifdef AQBANKING_VERSION_5_PLUS
+        gnc_gwengui_extended_by_ABBanking = GWEN_Gui_GetGui();
+        AB_Gui_Extend(gnc_gwengui_extended_by_ABBanking, api);
+#endif /* AQBANKING_VERSION_5_PLUS */
+
         /* Cache it */
         gnc_AB_BANKING = api;
         gnc_AB_BANKING_refcount = 0;
@@ -201,8 +212,7 @@
         if (api == gnc_AB_BANKING)
         {
             gnc_AB_BANKING = NULL;
-            if (gnc_AB_BANKING_refcount > 0)
-                AB_Banking_Fini(api);
+            gnc_AB_BANKING_fini(api);
         }
 
         AB_Banking_free(api);
@@ -216,10 +226,22 @@
     if (api == gnc_AB_BANKING)
     {
         if (--gnc_AB_BANKING_refcount == 0)
+        {
+#ifdef AQBANKING_VERSION_5_PLUS
+            if (gnc_gwengui_extended_by_ABBanking)
+                AB_Gui_Unextend(gnc_gwengui_extended_by_ABBanking);
+            gnc_gwengui_extended_by_ABBanking = NULL;
+#endif /* AQBANKING_VERSION_5_PLUS */
             return AB_Banking_Fini(api);
+        }
     }
     else
     {
+#ifdef AQBANKING_VERSION_5_PLUS
+        if (gnc_gwengui_extended_by_ABBanking)
+            AB_Gui_Unextend(gnc_gwengui_extended_by_ABBanking);
+        gnc_gwengui_extended_by_ABBanking = NULL;
+#endif /* AQBANKING_VERSION_5_PLUS */
         return AB_Banking_Fini(api);
     }
     return 0;



More information about the gnucash-changes mailing list