gnucash maint: Fix broken test-backend-dbi with libdbi 0.9.

John Ralls jralls at code.gnucash.org
Thu Aug 7 13:13:23 EDT 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/321a159a (commit)
	from  https://github.com/Gnucash/gnucash/commit/b465fef9 (commit)



commit 321a159af29a9b51fe793c2528dccb74b0443bf9
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Aug 7 10:00:39 2014 -0700

    Fix broken test-backend-dbi with libdbi 0.9.
    
    Segfaulted for an uninitialized dbi_instance.

diff --git a/configure.ac b/configure.ac
index bb07382..2f70fc5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,7 @@ GNUCASH_NANO_VERSION=0
 #src/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load.
 GNUCASH_RESAVE_VERSION=19920
 # Initialize automake -- make sure we have at least version 1.9
-AM_INIT_AUTOMAKE([1.9 dist-bzip2])
+AM_INIT_AUTOMAKE([1.9 dist-bzip2 subdir-objects])
 
 # Parse out the version number
 GNUCASH_VERSION_STRING=AC_PACKAGE_VERSION
diff --git a/src/backend/dbi/test/test-backend-dbi-basic.c b/src/backend/dbi/test/test-backend-dbi-basic.c
index d7e88eb..b3203f0 100644
--- a/src/backend/dbi/test/test-backend-dbi-basic.c
+++ b/src/backend/dbi/test/test-backend-dbi-basic.c
@@ -36,7 +36,7 @@
 
 #if LIBDBI_VERSION >= 900
 #define HAVE_LIBDBI_R 1
-static dbi_inst dbi_instance;
+static dbi_inst dbi_instance = NULL;
 #else
 #define HAVE_LIBDBI_R 0
 #endif
@@ -597,8 +597,11 @@ test_suite_gnc_backend_dbi (void)
     dbi_driver driver = NULL;
     GList *drivers = NULL;
     #if HAVE_LIBDBI_R
+    if (dbi_instance == NULL)
+      dbi_initialize_r (NULL, &dbi_instance);
     while ((driver = dbi_driver_list_r (driver, dbi_instance)))
     #else
+    dbi_initialize (NULL);
     while ((driver = dbi_driver_list (driver)))
     #endif
     {



Summary of changes:
 configure.ac                                  | 2 +-
 src/backend/dbi/test/test-backend-dbi-basic.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list