Perform explicit sqlite3 init/deinit

This commit is contained in:
Julien BLACHE 2010-04-26 18:24:09 +02:00
parent 4551d530f9
commit 0411720a58
3 changed files with 18 additions and 0 deletions

View File

@ -3931,6 +3931,13 @@ db_init(void)
db_path = cfg_getstr(cfg_getsec(cfg, "general"), "db_path");
ret = sqlite3_initialize();
if (ret != SQLITE_OK)
{
DPRINTF(E_FATAL, L_DB, "SQLite3 failed to initialize\n");
return -1;
}
if (!sqlite3_threadsafe())
{
DPRINTF(E_FATAL, L_DB, "The SQLite3 library is not built with a threadsafe configuration\n");
@ -3964,3 +3971,9 @@ db_init(void)
return 0;
}
void
db_deinit(void)
{
sqlite3_shutdown();
}

View File

@ -445,4 +445,7 @@ db_perthread_deinit(void);
int
db_init(void);
void
db_deinit(void);
#endif /* !__DB_H__ */

View File

@ -748,7 +748,9 @@ main(int argc, char **argv)
filescanner_deinit();
filescanner_fail:
DPRINTF(E_LOG, L_MAIN, "Database deinit\n");
db_perthread_deinit();
db_deinit();
db_fail:
if (ret == EXIT_FAILURE)
{