r15320 - gnucash/trunk - Call g_module_make_resident in qof backend provider modules.

Andreas Köhler andi5 at cvs.gnucash.org
Sun Jan 7 02:04:20 EST 2007


Author: andi5
Date: 2007-01-07 02:04:17 -0500 (Sun, 07 Jan 2007)
New Revision: 15320
Trac: http://svn.gnucash.org/trac/changeset/15320

Modified:
   gnucash/trunk/lib/libqof/backend/file/qsf-backend.c
   gnucash/trunk/lib/libqof/qof/qofbackend.c
   gnucash/trunk/src/backend/file/gnc-backend-file.c
Log:
Call g_module_make_resident in qof backend provider modules.

If the GncModule system finds a QofBackendProvider module M before that
has been initialized by QOF, M will register itself with QOF but does
not mark itself as resident, so the module system will unload it again,
leaving bogus pointers in QOF. Now it does.


Modified: gnucash/trunk/lib/libqof/backend/file/qsf-backend.c
===================================================================
--- gnucash/trunk/lib/libqof/backend/file/qsf-backend.c	2007-01-07 02:04:29 UTC (rev 15319)
+++ gnucash/trunk/lib/libqof/backend/file/qsf-backend.c	2007-01-07 07:04:17 UTC (rev 15320)
@@ -1287,5 +1287,6 @@
 	prov->check_data_type = qsf_determine_file_type;
 	prov->provider_free = qsf_provider_free;
 	qof_backend_register_provider (prov);
+	g_module_make_resident (module);
 	return NULL;
 }

Modified: gnucash/trunk/lib/libqof/qof/qofbackend.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbackend.c	2007-01-07 02:04:29 UTC (rev 15319)
+++ gnucash/trunk/lib/libqof/qof/qofbackend.c	2007-01-07 07:04:17 UTC (rev 15320)
@@ -392,10 +392,12 @@
 	g_return_val_if_fail(g_module_supported(), FALSE);
 	fullpath = g_module_build_path(directory, module_name);
 	backend = g_module_open(fullpath, G_MODULE_BIND_LAZY);
-	if (!backend) { 
+	if (!backend) {
 		g_message ("%s: %s\n", PACKAGE, g_module_error ());
 		return FALSE;
 	}
+
+	/* the module should have done that already in g_module_check_init */
 	g_module_make_resident(backend);
 	return TRUE;
 }

Modified: gnucash/trunk/src/backend/file/gnc-backend-file.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-backend-file.c	2007-01-07 02:04:29 UTC (rev 15319)
+++ gnucash/trunk/src/backend/file/gnc-backend-file.c	2007-01-07 07:04:17 UTC (rev 15320)
@@ -1069,8 +1069,9 @@
         prov->partial_book_supported = FALSE;
         prov->backend_new = gnc_backend_new;
         prov->provider_free = gnc_provider_free;
-	prov->check_data_type = gnc_determine_file_type;
+        prov->check_data_type = gnc_determine_file_type;
         qof_backend_register_provider (prov);
+        g_module_make_resident (module);
         return NULL;
 }
 



More information about the gnucash-changes mailing list