summaryrefslogtreecommitdiffstats
path: root/common/genericresource.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-07 09:15:20 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-07 09:15:20 +0200
commit5cba3372881994b5afa96449237aab80cc424e6d (patch)
tree34284cca22e42410a0dd375a0cfdb02e3b94fa7c /common/genericresource.cpp
parentac61e46c81e248841829adfc63b1804b9df6feb1 (diff)
downloadsink-5cba3372881994b5afa96449237aab80cc424e6d.tar.gz
sink-5cba3372881994b5afa96449237aab80cc424e6d.zip
Less memory leaking with unique_ptr
Diffstat (limited to 'common/genericresource.cpp')
-rw-r--r--common/genericresource.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp
index 2b9e7b2..ed7dd46 100644
--- a/common/genericresource.cpp
+++ b/common/genericresource.cpp
@@ -240,7 +240,7 @@ GenericResource::GenericResource(const QByteArray &resourceType, const QByteArra
240 mClientLowerBoundRevision(std::numeric_limits<qint64>::max()) 240 mClientLowerBoundRevision(std::numeric_limits<qint64>::max())
241{ 241{
242 mPipeline->setResourceType(mResourceType); 242 mPipeline->setResourceType(mResourceType);
243 mProcessor = new CommandProcessor(mPipeline.data(), QList<MessageQueue *>() << &mUserQueue << &mSynchronizerQueue); 243 mProcessor = std::unique_ptr<CommandProcessor>(new CommandProcessor(mPipeline.data(), QList<MessageQueue *>() << &mUserQueue << &mSynchronizerQueue));
244 mProcessor->setInspectionCommand([this](void const *command, size_t size) { 244 mProcessor->setInspectionCommand([this](void const *command, size_t size) {
245 flatbuffers::Verifier verifier((const uint8_t *)command, size); 245 flatbuffers::Verifier verifier((const uint8_t *)command, size);
246 if (Sink::Commands::VerifyInspectionBuffer(verifier)) { 246 if (Sink::Commands::VerifyInspectionBuffer(verifier)) {
@@ -280,7 +280,7 @@ GenericResource::GenericResource(const QByteArray &resourceType, const QByteArra
280 return KAsync::error<void>(-1, "Invalid inspection command."); 280 return KAsync::error<void>(-1, "Invalid inspection command.");
281 }); 281 });
282 { 282 {
283 auto ret =QObject::connect(mProcessor, &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); 283 auto ret =QObject::connect(mProcessor.get(), &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); });
284 Q_ASSERT(ret); 284 Q_ASSERT(ret);
285 } 285 }
286 { 286 {
@@ -296,7 +296,6 @@ GenericResource::GenericResource(const QByteArray &resourceType, const QByteArra
296 296
297GenericResource::~GenericResource() 297GenericResource::~GenericResource()
298{ 298{
299 delete mProcessor;
300} 299}
301 300
302KAsync::Job<void> GenericResource::inspect( 301KAsync::Job<void> GenericResource::inspect(