Instance: use std::unique_ptr<> to manage the Database pointer
This commit is contained in:
@@ -294,7 +294,7 @@ handle_update(Client &client, Request args, Response &r, bool discard)
|
||||
if (update != nullptr)
|
||||
return handle_update(r, *update, path, discard);
|
||||
|
||||
Database *db = client.GetInstance().database;
|
||||
Database *db = client.GetInstance().GetDatabase();
|
||||
if (db != nullptr)
|
||||
return handle_update(r, *db, path, discard);
|
||||
#else
|
||||
|
@@ -209,7 +209,7 @@ handle_mount(Client &client, Request args, Response &r)
|
||||
instance.EmitIdle(IDLE_MOUNT);
|
||||
|
||||
#ifdef ENABLE_DATABASE
|
||||
if (auto *db = dynamic_cast<SimpleDatabase *>(instance.database)) {
|
||||
if (auto *db = dynamic_cast<SimpleDatabase *>(instance.GetDatabase())) {
|
||||
try {
|
||||
db->Mount(local_uri, remote_uri);
|
||||
} catch (...) {
|
||||
@@ -253,7 +253,7 @@ handle_unmount(Client &client, Request args, Response &r)
|
||||
destroy here */
|
||||
instance.update->CancelMount(local_uri);
|
||||
|
||||
if (auto *db = dynamic_cast<SimpleDatabase *>(instance.database)) {
|
||||
if (auto *db = dynamic_cast<SimpleDatabase *>(instance.GetDatabase())) {
|
||||
if (db->Unmount(local_uri))
|
||||
// TODO: call Instance::OnDatabaseModified()?
|
||||
instance.EmitIdle(IDLE_DATABASE);
|
||||
|
Reference in New Issue
Block a user