summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-09-04 08:39:29 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-09-04 08:39:42 (GMT)
commit49743a22f184b4948904b485c88f8af3321812b6 (patch)
treed52a3fb2291938b0a4b34f3b0ffe4cfc17ff612a
parentcd404da0442a09e97c6259198a7c7d8c10d5ac0e (diff)
Fix linkhandler test ASAN error on CI
-rw-r--r--autotests/server/akappendhandlertest.cpp2
-rw-r--r--autotests/server/collectionreferencetest.cpp2
-rw-r--r--autotests/server/createhandlertest.cpp2
-rw-r--r--autotests/server/fakeakonadiserver.cpp7
-rw-r--r--autotests/server/fakeakonadiserver.h5
-rw-r--r--autotests/server/linkhandlertest.cpp4
-rw-r--r--autotests/server/modifyhandlertest.cpp2
-rw-r--r--autotests/server/relationhandlertest.cpp2
-rw-r--r--autotests/server/taghandlertest.cpp2
9 files changed, 13 insertions, 15 deletions
diff --git a/autotests/server/akappendhandlertest.cpp b/autotests/server/akappendhandlertest.cpp
index d0841ee..4fd6881 100644
--- a/autotests/server/akappendhandlertest.cpp
+++ b/autotests/server/akappendhandlertest.cpp
@@ -683,7 +683,7 @@ private Q_SLOTS:
FakeAkonadiServer::instance()->setScenarios(scenarios);
FakeAkonadiServer::instance()->runTest();
- QSignalSpy *notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
+ auto notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
if (notification.isValid()) {
QCOMPARE(notificationSpy->count(), 1);
diff --git a/autotests/server/collectionreferencetest.cpp b/autotests/server/collectionreferencetest.cpp
index 9ae3185..4387033 100644
--- a/autotests/server/collectionreferencetest.cpp
+++ b/autotests/server/collectionreferencetest.cpp
@@ -189,7 +189,7 @@ private Q_SLOTS:
FakeAkonadiServer::instance()->setScenarios(scenarios);
FakeAkonadiServer::instance()->runTest();
- QSignalSpy *notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
+ auto notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
if (expectedNotifications.isEmpty()) {
QTRY_VERIFY(notificationSpy->isEmpty() || notificationSpy->takeFirst().first().value<Protocol::ChangeNotification::List>().isEmpty());
} else {
diff --git a/autotests/server/createhandlertest.cpp b/autotests/server/createhandlertest.cpp
index ccd8cc6..8c5ded8 100644
--- a/autotests/server/createhandlertest.cpp
+++ b/autotests/server/createhandlertest.cpp
@@ -174,7 +174,7 @@ private Q_SLOTS:
FakeAkonadiServer::instance()->setScenarios(scenarios);
FakeAkonadiServer::instance()->runTest();
- QSignalSpy *notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
+ auto notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
if (notification.isValid()) {
QCOMPARE(notificationSpy->count(), 1);
const Protocol::ChangeNotification::List notifications = notificationSpy->takeFirst().first().value<Protocol::ChangeNotification::List>();
diff --git a/autotests/server/fakeakonadiserver.cpp b/autotests/server/fakeakonadiserver.cpp
index 1b3ccae..9df989a 100644
--- a/autotests/server/fakeakonadiserver.cpp
+++ b/autotests/server/fakeakonadiserver.cpp
@@ -105,7 +105,6 @@ FakeAkonadiServer::FakeAkonadiServer()
, mDataStore(Q_NULLPTR)
, mServerLoop(Q_NULLPTR)
, mNtfCollector(Q_NULLPTR)
- , mNotificationSpy(Q_NULLPTR)
, mPopulateDb(true)
{
qputenv("AKONADI_INSTANCE", qPrintable(instanceName()));
@@ -121,7 +120,6 @@ FakeAkonadiServer::~FakeAkonadiServer()
{
delete mClient;
delete mConnection;
- delete mNotificationSpy;
delete mNtfCollector;
}
@@ -283,7 +281,6 @@ void FakeAkonadiServer::setScenarios(const TestScenario::List &scenarios)
void FakeAkonadiServer::newCmdConnection(quintptr socketDescriptor)
{
mConnection = new FakeConnection(socketDescriptor);
- delete mNotificationSpy;
// Delete collection in its own thread
mNtfCollector->deleteLater();
@@ -292,7 +289,7 @@ void FakeAkonadiServer::newCmdConnection(quintptr socketDescriptor)
QMetaObject::invokeMethod(mConnection, "notificationCollector", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(Akonadi::Server::NotificationCollector*, mNtfCollector));
Q_ASSERT(mNtfCollector);
- mNotificationSpy = new QSignalSpy(mNtfCollector, &Server::NotificationCollector::notify);
+ mNotificationSpy.reset(new QSignalSpy(mNtfCollector, &Server::NotificationCollector::notify));
Q_ASSERT(mNotificationSpy->isValid());
}
@@ -322,7 +319,7 @@ void FakeAkonadiServer::runTest()
mNtfCollector->dispatchNotifications();
}
-QSignalSpy *FakeAkonadiServer::notificationSpy() const
+QSharedPointer<QSignalSpy> FakeAkonadiServer::notificationSpy() const
{
return mNotificationSpy;
}
diff --git a/autotests/server/fakeakonadiserver.h b/autotests/server/fakeakonadiserver.h
index 582cd89..49b4a45 100644
--- a/autotests/server/fakeakonadiserver.h
+++ b/autotests/server/fakeakonadiserver.h
@@ -26,6 +26,7 @@
#include <QBuffer>
#include <QDataStream>
#include <QtTest/QTest>
+#include <QSharedPointer>
#include <type_traits>
@@ -105,7 +106,7 @@ public:
void runTest();
- QSignalSpy *notificationSpy() const;
+ QSharedPointer<QSignalSpy> notificationSpy() const;
void setPopulateDb(bool populate);
@@ -125,7 +126,7 @@ private:
QEventLoop *mServerLoop;
NotificationCollector *mNtfCollector;
- QSignalSpy *mNotificationSpy;
+ QSharedPointer<QSignalSpy> mNotificationSpy;
bool mPopulateDb;
diff --git a/autotests/server/linkhandlertest.cpp b/autotests/server/linkhandlertest.cpp
index 1d24433..0967966 100644
--- a/autotests/server/linkhandlertest.cpp
+++ b/autotests/server/linkhandlertest.cpp
@@ -150,7 +150,7 @@ private Q_SLOTS:
FakeAkonadiServer::instance()->setScenarios(scenarios);
FakeAkonadiServer::instance()->runTest();
- QSignalSpy *notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
+ auto notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
if (notification.isValid()) {
QCOMPARE(notificationSpy->count(), 1);
const Protocol::ChangeNotification::List notifications = notificationSpy->takeFirst().first().value<Protocol::ChangeNotification::List>();
@@ -254,7 +254,7 @@ private Q_SLOTS:
FakeAkonadiServer::instance()->setScenarios(scenarios);
FakeAkonadiServer::instance()->runTest();
- QSignalSpy *notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
+ auto notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
if (notification.isValid()) {
QCOMPARE(notificationSpy->count(), 1);
const Protocol::ChangeNotification::List notifications = notificationSpy->takeFirst().first().value<Protocol::ChangeNotification::List>();
diff --git a/autotests/server/modifyhandlertest.cpp b/autotests/server/modifyhandlertest.cpp
index d44a44d..da22c32 100644
--- a/autotests/server/modifyhandlertest.cpp
+++ b/autotests/server/modifyhandlertest.cpp
@@ -147,7 +147,7 @@ private Q_SLOTS:
FakeAkonadiServer::instance()->setScenarios(scenarios);
FakeAkonadiServer::instance()->runTest();
- QSignalSpy *notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
+ auto notificationSpy = FakeAkonadiServer::instance()->notificationSpy();
if (expectedNotifications.isEmpty()) {
QVERIFY(notificationSpy->isEmpty() || notificationSpy->takeFirst().first().value<Protocol::ChangeNotification::List>().isEmpty());
return;
diff --git a/autotests/server/relationhandlertest.cpp b/autotests/server/relationhandlertest.cpp
index bb764c3..0d4c0f1 100644
--- a/autotests/server/relationhandlertest.cpp
+++ b/autotests/server/relationhandlertest.cpp
@@ -35,7 +35,7 @@ using namespace Akonadi::Server;
Q_DECLARE_METATYPE(Akonadi::Server::Relation::List)
Q_DECLARE_METATYPE(Akonadi::Server::Relation)
-static Protocol::ChangeNotification::List extractNotifications(QSignalSpy *notificationSpy)
+static Protocol::ChangeNotification::List extractNotifications(const QSharedPointer<QSignalSpy> &notificationSpy)
{
Protocol::ChangeNotification::List receivedNotifications;
for (int q = 0; q < notificationSpy->size(); q++) {
diff --git a/autotests/server/taghandlertest.cpp b/autotests/server/taghandlertest.cpp
index 66041e6..88a7cfc 100644
--- a/autotests/server/taghandlertest.cpp
+++ b/autotests/server/taghandlertest.cpp
@@ -40,7 +40,7 @@ Q_DECLARE_METATYPE(Akonadi::Server::Tag::List)
Q_DECLARE_METATYPE(Akonadi::Server::Tag)
Q_DECLARE_METATYPE(QVector<TagTagAttributeListPair>)
-static Protocol::ChangeNotification::List extractNotifications(QSignalSpy *notificationSpy)
+static Protocol::ChangeNotification::List extractNotifications(const QSharedPointer<QSignalSpy> &notificationSpy)
{
Protocol::ChangeNotification::List receivedNotifications;
for (int q = 0; q < notificationSpy->size(); q++) {