diff --git a/src/db/update/Service.cxx b/src/db/update/Service.cxx index dafe21850..a4e4d85bc 100644 --- a/src/db/update/Service.cxx +++ b/src/db/update/Service.cxx @@ -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(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(); diff --git a/src/db/update/Service.hxx b/src/db/update/Service.hxx index a03e451ad..7aff18272 100644 --- a/src/db/update/Service.hxx +++ b/src/db/update/Service.hxx @@ -26,6 +26,8 @@ #include "thread/Thread.hxx" #include "util/Compiler.h" +#include + class SimpleDatabase; class DatabaseListener; class UpdateWalk; @@ -56,7 +58,7 @@ class UpdateService final { UpdateQueueItem next; - UpdateWalk *walk = nullptr; + std::unique_ptr walk; public: UpdateService(const ConfigData &_config,