summaryrefslogtreecommitdiffstats
path: root/tests/auto/dbus
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-05-08 15:24:27 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-09 03:39:34 +0200
commite0e86d5651cc8b430b381f1278c917e51671d23e (patch)
treec004ca43489e637a6f660d3c42212eae04da8c81 /tests/auto/dbus
parenta982243b97a9cb050689b19c848d794bd79a2b0e (diff)
Fix dangling pointer dereferencing
That long call chain is screaming "here, I'm dereferencing dangling pointers! Valgrind me!" but 2006 Thiago didn't see them... Change-Id: I44de5aea113d05edec2227e9db6be8cec9303be9 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'tests/auto/dbus')
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
index e1ce12d7d5..57a4a19179 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
@@ -367,11 +367,11 @@ void emitSignalPeer(const QString &interface, const QString &name, const QVarian
QTest::qWait(1000);
}
-const char* slotSpyPeer()
+QString slotSpyPeer()
{
QDBusMessage req = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "slotSpyServer");
QDBusMessage reply = QDBusConnection::sessionBus().call(req);
- return reply.arguments().at(0).toString().toLatin1().data();
+ return reply.arguments().at(0).toString();
}
QString valueSpyPeer()
@@ -1108,7 +1108,7 @@ void tst_QDBusAbstractAdaptor::methodCallsPeer()
// simple call: one such method exists
QCOMPARE(if2.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ReplyMessage);
- QCOMPARE(slotSpyPeer(), "void Interface2::method()");
+ QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface2::method()"));
if (!nInterfaces--)
return;
@@ -1121,24 +1121,24 @@ void tst_QDBusAbstractAdaptor::methodCallsPeer()
QCOMPARE(if2.call(QDBus::BlockWithGui, "methodString").type(), QDBusMessage::ErrorMessage);
QCOMPARE(if3.call(QDBus::BlockWithGui, "methodVoid").type(), QDBusMessage::ReplyMessage);
- QCOMPARE(slotSpyPeer(), "void Interface3::methodVoid()");
+ QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface3::methodVoid()"));
QCOMPARE(if3.call(QDBus::BlockWithGui, "methodInt", 42).type(), QDBusMessage::ReplyMessage);
- QCOMPARE(slotSpyPeer(), "void Interface3::methodInt(int)");
+ QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface3::methodInt(int)"));
QCOMPARE(if3.call(QDBus::BlockWithGui, "methodString", QString("")).type(), QDBusMessage::ReplyMessage);
- QCOMPARE(slotSpyPeer(), "void Interface3::methodString(QString)");
+ QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface3::methodString(QString)"));
if (!nInterfaces--)
return;
// method overloading: different interfaces
QCOMPARE(if4.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ReplyMessage);
- QCOMPARE(slotSpyPeer(), "void Interface4::method()");
+ QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface4::method()"));
// method overloading: different parameters
QCOMPARE(if4.call(QDBus::BlockWithGui, "method.i", 42).type(), QDBusMessage::ReplyMessage);
- QCOMPARE(slotSpyPeer(), "void Interface4::method(int)");
+ QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface4::method(int)"));
QCOMPARE(if4.call(QDBus::BlockWithGui, "method.s", QString()).type(), QDBusMessage::ReplyMessage);
- QCOMPARE(slotSpyPeer(), "void Interface4::method(QString)");
+ QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface4::method(QString)"));
}
void tst_QDBusAbstractAdaptor::methodCallScriptablePeer()
@@ -1152,7 +1152,7 @@ void tst_QDBusAbstractAdaptor::methodCallScriptablePeer()
QDBusInterface if2(QString(), "/", "local.Interface2", con);
QCOMPARE(if2.call(QDBus::BlockWithGui,"scriptableMethod").type(), QDBusMessage::ReplyMessage);
- QCOMPARE(slotSpyPeer(), "void Interface2::scriptableMethod()");
+ QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface2::scriptableMethod()"));
}
void tst_QDBusAbstractAdaptor::signalEmissionsPeer_data()