diff options
author | Max Kellermann <max@duempel.org> | 2014-02-04 10:09:09 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-04 11:22:32 +0100 |
commit | f00710a57e80738c33255eaa1347ab776fbce869 (patch) | |
tree | 103dc00cbc4c4a0f6511e0593afa94d0a2d21456 | |
parent | c9539043433678f4cf5e09443f880f64f61c6fef (diff) | |
download | mpd-f00710a57e80738c33255eaa1347ab776fbce869.tar.gz mpd-f00710a57e80738c33255eaa1347ab776fbce869.tar.xz mpd-f00710a57e80738c33255eaa1347ab776fbce869.zip |
Main: create UpdateService instance in glue_db_init_and_load()
Diffstat (limited to '')
-rw-r--r-- | src/Instance.hxx | 6 | ||||
-rw-r--r-- | src/Main.cxx | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/Instance.hxx b/src/Instance.hxx index a2c141dc7..ea60072cb 100644 --- a/src/Instance.hxx +++ b/src/Instance.hxx @@ -62,6 +62,12 @@ struct Instance final Partition *partition; + Instance() { +#ifdef ENABLE_DATABASE + update = nullptr; +#endif + } + #ifdef ENABLE_DATABASE void DeleteSong(const char *uri); diff --git a/src/Main.cxx b/src/Main.cxx index 3cedfe267..d7d13e2b3 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -204,8 +204,13 @@ glue_db_init_and_load(void) if (!DatabaseGlobalOpen(error)) FatalError(error); + if (!db_is_simple()) + return true; + + instance->update = new UpdateService(*main_loop, db_get_simple()); + /* run database update after daemonization? */ - return !db_is_simple() || db_exists(); + return db_exists(); } #endif @@ -459,10 +464,6 @@ int mpd_main(int argc, char *argv[]) #ifdef ENABLE_DATABASE const bool create_db = !glue_db_init_and_load(); - - instance->update = db_is_simple() - ? new UpdateService(*main_loop, db_get_simple()) - : nullptr; #endif glue_sticker_init(); |