Perform explicit sqlite3 init/deinit
This commit is contained in:
parent
4551d530f9
commit
0411720a58
13
src/db.c
13
src/db.c
|
@ -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();
|
||||
}
|
||||
|
|
3
src/db.h
3
src/db.h
|
@ -445,4 +445,7 @@ db_perthread_deinit(void);
|
|||
int
|
||||
db_init(void);
|
||||
|
||||
void
|
||||
db_deinit(void);
|
||||
|
||||
#endif /* !__DB_H__ */
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue