diff --git a/autotests/libs/fakeserverdata.h b/autotests/libs/fakeserverdata.h --- a/autotests/libs/fakeserverdata.h +++ b/autotests/libs/fakeserverdata.h @@ -39,7 +39,7 @@ FakeServerData(EntityTreeModel *model, FakeSession *session, FakeMonitor *monitor, QObject *parent = nullptr); FakeServerData(TagModel *model, FakeSession *session, FakeMonitor *monitor, QObject *parent = nullptr); - void setCommands(QList list); + void setCommands(const QList &list); Collection::Id nextCollectionId() const { diff --git a/autotests/libs/fakeserverdata.cpp b/autotests/libs/fakeserverdata.cpp --- a/autotests/libs/fakeserverdata.cpp +++ b/autotests/libs/fakeserverdata.cpp @@ -61,10 +61,10 @@ } -void FakeServerData::setCommands(QList< FakeAkonadiServerCommand * > list) +void FakeServerData::setCommands(const QList &list) { m_communicationQueue.clear(); - Q_FOREACH (FakeAkonadiServerCommand *command, list) { + for (FakeAkonadiServerCommand *command : list) { m_communicationQueue << command; } } @@ -76,6 +76,7 @@ if (respondTo == FakeAkonadiServerCommand::Notification) { FakeAkonadiServerCommand *command = m_communicationQueue.dequeue(); command->doCommand(); + delete command; } else { return; } @@ -123,6 +124,7 @@ if (!m_communicationQueue.isEmpty()) { returnEntities(fetchColId); } + delete command; return true; } return false; @@ -138,6 +140,7 @@ if (!m_communicationQueue.isEmpty()) { returnEntities(fetchColId); } + delete command; } } @@ -148,5 +151,6 @@ if (commType == FakeAkonadiServerCommand::RespondToTagFetch) { FakeAkonadiServerCommand *command = m_communicationQueue.dequeue(); command->doCommand(); + delete command; } }