db/Plugin: use std::unique_ptr<> to manage Database pointers

This commit is contained in:
Max Kellermann
2019-02-20 20:32:11 +01:00
parent 2125e3ed57
commit 6c28adbcd2
15 changed files with 93 additions and 73 deletions

View File

@@ -133,15 +133,13 @@ try {
if (path != nullptr)
block.AddBlockParam("path", path->value, path->line);
Database *db = plugin->create(init.GetEventLoop(),
init.GetEventLoop(),
database_listener, block);
AtScopeExit(db) { delete db; };
auto db = plugin->create(init.GetEventLoop(),
init.GetEventLoop(),
database_listener, block);
db->Open();
AtScopeExit(db) { db->Close(); };
AtScopeExit(&db) { db->Close(); };
const DatabaseSelection selection("", true);