r16200 - gnucash/trunk - Do not register qof backend modules on first load, #433779.
Andreas Köhler
andi5 at cvs.gnucash.org
Fri Jun 22 09:31:34 EDT 2007
Author: andi5
Date: 2007-06-22 09:31:29 -0400 (Fri, 22 Jun 2007)
New Revision: 16200
Trac: http://svn.gnucash.org/trac/changeset/16200
Modified:
gnucash/trunk/lib/libqof/backend/file/qof-backend-qsf.h
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
gnucash/trunk/src/backend/file/gnc-backend-file.h
gnucash/trunk/src/backend/postgres/PostgresBackend.c
gnucash/trunk/src/backend/postgres/PostgresBackend.h
Log:
Do not register qof backend modules on first load, #433779.
Qof backend modules used to call qof_backend_register_provider() and
g_module_make_resident() directly in g_module_check_init(), i.e. they
could not be unloaded after the gnucash module crawler detected them.
Probably after the renaming of libgnc-backend-file the QSF backend
module started to register itself before the gnc file backend, spitting
a validation error on virtually every data file load.
So g_module_check_init() has been renamed to qof_backend_module_init()
and is now called by qof_load_backend_library().
Modified: gnucash/trunk/lib/libqof/backend/file/qof-backend-qsf.h
===================================================================
--- gnucash/trunk/lib/libqof/backend/file/qof-backend-qsf.h 2007-06-22 13:31:23 UTC (rev 16199)
+++ gnucash/trunk/lib/libqof/backend/file/qof-backend-qsf.h 2007-06-22 13:31:29 UTC (rev 16200)
@@ -159,8 +159,8 @@
functions that will load and save the data. Initialises
default values for the QofBackendOption KvpFrame.
*/
-G_MODULE_EXPORT const gchar *
-g_module_check_init(GModule *module);
+G_MODULE_EXPORT void
+qof_backend_module_init(void);
/** \name Supported backend configurations
@{
Modified: gnucash/trunk/lib/libqof/backend/file/qsf-backend.c
===================================================================
--- gnucash/trunk/lib/libqof/backend/file/qsf-backend.c 2007-06-22 13:31:23 UTC (rev 16199)
+++ gnucash/trunk/lib/libqof/backend/file/qsf-backend.c 2007-06-22 13:31:29 UTC (rev 16200)
@@ -1268,8 +1268,8 @@
g_free (prov);
}
-G_MODULE_EXPORT const gchar *
-g_module_check_init(GModule *module)
+G_MODULE_EXPORT void
+qof_backend_module_init (void)
{
QofBackendProvider *prov;
@@ -1281,6 +1281,4 @@
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-06-22 13:31:23 UTC (rev 16199)
+++ gnucash/trunk/lib/libqof/qof/qofbackend.c 2007-06-22 13:31:29 UTC (rev 16200)
@@ -388,6 +388,7 @@
{
gchar *fullpath;
GModule *backend;
+ void (*module_init_func) (void);
g_return_val_if_fail(g_module_supported(), FALSE);
fullpath = g_module_build_path(directory, module_name);
@@ -396,8 +397,10 @@
g_message ("%s: %s\n", PACKAGE, g_module_error ());
return FALSE;
}
+ if (g_module_symbol(backend, "qof_backend_module_init",
+ (gpointer)&module_init_func))
+ module_init_func();
- /* 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-06-22 13:31:23 UTC (rev 16199)
+++ gnucash/trunk/src/backend/file/gnc-backend-file.c 2007-06-22 13:31:29 UTC (rev 16200)
@@ -1057,8 +1057,8 @@
g_free (prov);
}
-G_MODULE_EXPORT const gchar *
-g_module_check_init(GModule *module)
+G_MODULE_EXPORT void
+qof_backend_module_init(void)
{
QofBackendProvider *prov;
prov = g_new0 (QofBackendProvider, 1);
@@ -1069,8 +1069,6 @@
prov->provider_free = gnc_provider_free;
prov->check_data_type = gnc_determine_file_type;
qof_backend_register_provider (prov);
- g_module_make_resident (module);
- return NULL;
}
/* ========================== END OF FILE ===================== */
Modified: gnucash/trunk/src/backend/file/gnc-backend-file.h
===================================================================
--- gnucash/trunk/src/backend/file/gnc-backend-file.h 2007-06-22 13:31:23 UTC (rev 16199)
+++ gnucash/trunk/src/backend/file/gnc-backend-file.h 2007-06-22 13:31:29 UTC (rev 16200)
@@ -56,7 +56,7 @@
// This is now a static inside the module
//QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void);
-G_MODULE_EXPORT const gchar *
-g_module_check_init(GModule *module);
+G_MODULE_EXPORT void
+qof_backend_module_init(void);
#endif /* GNC_BACKEND_FILE_H_ */
Modified: gnucash/trunk/src/backend/postgres/PostgresBackend.c
===================================================================
--- gnucash/trunk/src/backend/postgres/PostgresBackend.c 2007-06-22 13:31:23 UTC (rev 16199)
+++ gnucash/trunk/src/backend/postgres/PostgresBackend.c 2007-06-22 13:31:29 UTC (rev 16200)
@@ -2536,8 +2536,8 @@
g_free (prov);
}
-G_MODULE_EXPORT const gchar *
-g_module_check_init(GModule *module)
+G_MODULE_EXPORT void
+qof_backend_module_init(void)
{
QofBackendProvider *prov;
@@ -2549,7 +2549,6 @@
prov->provider_free = pg_provider_free;
prov->check_data_type = NULL;
qof_backend_register_provider (prov);
- return NULL;
}
/* ======================== END OF FILE ======================== */
Modified: gnucash/trunk/src/backend/postgres/PostgresBackend.h
===================================================================
--- gnucash/trunk/src/backend/postgres/PostgresBackend.h 2007-06-22 13:31:23 UTC (rev 16199)
+++ gnucash/trunk/src/backend/postgres/PostgresBackend.h 2007-06-22 13:31:29 UTC (rev 16200)
@@ -133,7 +133,7 @@
void pgendDisable (PGBackend *be);
void pgendEnable (PGBackend *be);
-G_MODULE_EXPORT const gchar *
-g_module_check_init(GModule *module);
+G_MODULE_EXPORT void
+qof_backend_module_init(void);
#endif /* POSTGRES_BACKEND_H */
More information about the gnucash-changes
mailing list