mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add qof_finalize_backend_libraries() which is called during shutdown. This routine checks each backend
library for an exported qof_backend_module_finalize() routine, and if it exists, calls it so that the backend can free any resources which have been allocated. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18485 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
16144d6828
commit
a3b87ece92
@ -502,6 +502,8 @@ qof_backend_commit_exists(const QofBackend *be)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GSList* backend_module_list = NULL;
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
qof_load_backend_library (const char *directory, const char* module_name)
|
qof_load_backend_library (const char *directory, const char* module_name)
|
||||||
{
|
{
|
||||||
@ -523,7 +525,25 @@ qof_load_backend_library (const char *directory, const char* module_name)
|
|||||||
module_init_func();
|
module_init_func();
|
||||||
|
|
||||||
g_module_make_resident(backend);
|
g_module_make_resident(backend);
|
||||||
|
backend_module_list = g_slist_prepend( backend_module_list, backend );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
qof_finalize_backend_libraries(void)
|
||||||
|
{
|
||||||
|
GSList* node;
|
||||||
|
GModule* backend;
|
||||||
|
void (*module_finalize_func) (void);
|
||||||
|
|
||||||
|
for (node = backend_module_list; node != NULL; node = node->next) {
|
||||||
|
backend = (GModule*)node->data;
|
||||||
|
|
||||||
|
if (g_module_symbol(backend, "qof_backend_module_finalize",
|
||||||
|
(gpointer)&module_finalize_func))
|
||||||
|
module_finalize_func();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/************************* END OF FILE ********************************/
|
/************************* END OF FILE ********************************/
|
||||||
|
@ -269,6 +269,9 @@ KvpFrame* qof_backend_get_config(QofBackend *be);
|
|||||||
gboolean
|
gboolean
|
||||||
qof_load_backend_library(const gchar *directory, const gchar* module_name);
|
qof_load_backend_library(const gchar *directory, const gchar* module_name);
|
||||||
|
|
||||||
|
/** \brief Finalize all loaded backend sharable libraries. */
|
||||||
|
void qof_finalize_backend_libraries(void);
|
||||||
|
|
||||||
/** \brief Retrieve the backend used by this book */
|
/** \brief Retrieve the backend used by this book */
|
||||||
QofBackend* qof_book_get_backend (const QofBook *book);
|
QofBackend* qof_book_get_backend (const QofBook *book);
|
||||||
|
|
||||||
|
@ -523,6 +523,7 @@ qof_close(void)
|
|||||||
qof_query_shutdown ();
|
qof_query_shutdown ();
|
||||||
qof_object_shutdown ();
|
qof_object_shutdown ();
|
||||||
guid_shutdown ();
|
guid_shutdown ();
|
||||||
|
qof_finalize_backend_libraries();
|
||||||
qof_util_string_cache_destroy ();
|
qof_util_string_cache_destroy ();
|
||||||
qof_log_shutdown();
|
qof_log_shutdown();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user