[Gnucash-changes] r14208 - gnucash/trunk - QOF should load its own
backend libraries.
Derek Atkins
warlord at cvs.gnucash.org
Fri May 26 17:45:15 EDT 2006
Author: warlord
Date: 2006-05-26 17:45:10 -0400 (Fri, 26 May 2006)
New Revision: 14208
Trac: http://svn.gnucash.org/trac/changeset/14208
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/lib/libqof/qof/qofsession.c
gnucash/trunk/src/engine/gnc-engine.c
Log:
QOF should load its own backend libraries.
It shouldn't depend on apps to load QOF libraries.
Make sure app-defined backends are used first.
Fix a memory leak in qofsession.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-05-26 19:45:56 UTC (rev 14207)
+++ gnucash/trunk/ChangeLog 2006-05-26 21:45:10 UTC (rev 14208)
@@ -5,6 +5,13 @@
* src/engine/gnc-engine.c:
force-exit gnucash if a required library can't be loaded.
+ * src/engine/gnc-engine.c:
+ * lib/libqof/qof/qofsession.c:
+ QOF should load its own backend libraries.
+ It shouldn't depend on apps to load QOF libraries.
+ Make sure app-defined backends are used first.
+ Fix a memory leak in qofsession.
+
2006-05-26 Christian Stimming <stimming at tuhh.de>
* src/import-export/hbci/druid-hbci-initial.c: Simplify calling
Modified: gnucash/trunk/lib/libqof/qof/qofsession.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofsession.c 2006-05-26 19:45:56 UTC (rev 14207)
+++ gnucash/trunk/lib/libqof/qof/qofsession.c 2006-05-26 21:45:10 UTC (rev 14208)
@@ -52,13 +52,14 @@
static GHookList * session_closed_hooks = NULL;
static QofLogModule log_module = QOF_MOD_SESSION;
static GSList *provider_list = NULL;
+static gboolean qof_providers_initialized = FALSE;
/* ====================================================================== */
void
qof_backend_register_provider (QofBackendProvider *prov)
{
- provider_list = g_slist_prepend (provider_list, prov);
+ provider_list = g_slist_append (provider_list, prov);
}
/* ====================================================================== */
@@ -846,7 +847,7 @@
};
/* All available QOF backends need to be described here
-and the last entry must be three NULL's.
+and the last entry must be two NULL's.
Remember: Use the libdir from the current build environment
and use JUST the module name without .so - .so is not portable! */
struct backend_providers backend_list[] = {
@@ -869,9 +870,10 @@
gboolean prov_type;
gboolean (*type_check) (const char*);
- ENTER (" list=%d", g_slist_length(provider_list));
+ ENTER (" list=%d, initted=%s", g_slist_length(provider_list),
+ qof_providers_initialized ? "true" : "false");
prov_type = FALSE;
- if (NULL == provider_list)
+ if (!qof_providers_initialized)
{
for (num = 0; backend_list[num].filename != NULL; num++) {
if(!qof_load_backend_library(backend_list[num].libdir,
@@ -881,8 +883,9 @@
backend_list[num].filename, backend_list[num].libdir);
}
}
+ qof_providers_initialized = TRUE;
}
- p = g_slist_copy(provider_list);
+ p = provider_list;
while(p != NULL)
{
prov = p->data;
@@ -1204,14 +1207,15 @@
if(change_backend == TRUE)
{
qof_session_destroy_backend(session);
- if (NULL == provider_list)
+ if (!qof_providers_initialized)
{
for (num = 0; backend_list[num].filename != NULL; num++) {
qof_load_backend_library(backend_list[num].libdir,
backend_list[num].filename);
}
+ qof_providers_initialized = TRUE;
}
- p = g_slist_copy(provider_list);
+ p = provider_list;
while(p != NULL)
{
prov = p->data;
Modified: gnucash/trunk/src/engine/gnc-engine.c
===================================================================
--- gnucash/trunk/src/engine/gnc-engine.c 2006-05-26 19:45:56 UTC (rev 14207)
+++ gnucash/trunk/src/engine/gnc-engine.c 2006-05-26 21:45:10 UTC (rev 14208)
@@ -80,7 +80,6 @@
const gchar* lib;
gboolean required;
} libs[] = {
- { QOF_LIB_DIR, QSF_BACKEND_LIB, FALSE },
{ GNC_LIBDIR, GNC_LIB_NAME, TRUE },
/* shouldn't the PG gnc-module do this instead of US doing it? */
{ GNC_LIBDIR, "gnc-backend-postgres", FALSE },
More information about the gnucash-changes
mailing list