db/update/Service: wrap UpdateWalk in std::unique_ptr<>

This commit is contained in:
Max Kellermann 2019-04-26 14:53:54 +02:00
parent afdaaba045
commit 2b4e9cc635
2 changed files with 6 additions and 6 deletions

View File

@ -56,8 +56,6 @@ UpdateService::~UpdateService()
if (update_thread.IsDefined())
update_thread.Join();
delete walk;
}
void
@ -151,7 +149,8 @@ UpdateService::StartThread(UpdateQueueItem &&i)
modified = false;
next = std::move(i);
walk = new UpdateWalk(config, GetEventLoop(), listener, *next.storage);
walk = std::make_unique<UpdateWalk>(config, GetEventLoop(), listener,
*next.storage);
update_thread.Start();
@ -248,8 +247,7 @@ UpdateService::RunDeferred() noexcept
if (update_thread.IsDefined())
update_thread.Join();
delete walk;
walk = nullptr;
walk.reset();
next.Clear();

View File

@ -26,6 +26,8 @@
#include "thread/Thread.hxx"
#include "util/Compiler.h"
#include <memory>
class SimpleDatabase;
class DatabaseListener;
class UpdateWalk;
@ -56,7 +58,7 @@ class UpdateService final {
UpdateQueueItem next;
UpdateWalk *walk = nullptr;
std::unique_ptr<UpdateWalk> walk;
public:
UpdateService(const ConfigData &_config,