summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-30 18:02:10 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-30 18:02:10 (GMT)
commit9155bb1413c8818d4283825a80650cfa978ff47c (patch)
tree175c65eb074a439e1a087657b29c275505fe1a1e
parent15ac39c60c752eedb51ca6db74f16097c40e35f4 (diff)
parent2fb0d29126a4d0583dcbeb03c6205bd7b7aa794f (diff)
downloadQt-9155bb1413c8818d4283825a80650cfa978ff47c.zip
Qt-9155bb1413c8818d4283825a80650cfa978ff47c.tar.gz
Qt-9155bb1413c8818d4283825a80650cfa978ff47c.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Fix crash in QDBusInterface when invoking a method in a derived class. tst_selftest: Fix off-by-one error in cleaning up line numbers and filenames
-rw-r--r--src/dbus/qdbusinterface.cpp2
-rw-r--r--tests/auto/qdbusinterface/tst_qdbusinterface.cpp22
-rw-r--r--tests/auto/selftests/tst_selftests.cpp4
3 files changed, 25 insertions, 3 deletions
diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp
index 300f425..56d5231 100644
--- a/src/dbus/qdbusinterface.cpp
+++ b/src/dbus/qdbusinterface.cpp
@@ -258,7 +258,7 @@ void *QDBusInterface::qt_metacast(const char *_clname)
int QDBusInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDBusAbstractInterface::qt_metacall(_c, _id, _a);
- if (_id < 0 || !d_func()->isValid)
+ if (_id < 0 || !d_func()->isValid || !d_func()->metaObject)
return _id;
return d_func()->metacall(_c, _id, _a);
}
diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
index 826bd70..d8ff2d3 100644
--- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
@@ -157,6 +157,18 @@ public slots:
}
};
+class DerivedFromQDBusInterface: public QDBusInterface
+{
+ Q_OBJECT
+public:
+ DerivedFromQDBusInterface()
+ : QDBusInterface("com.example.Test", "/")
+ {}
+
+public slots:
+ void method() {}
+};
+
// helper function
void emitSignal(const QString &interface, const QString &name, const QString &arg)
{
@@ -183,6 +195,7 @@ private slots:
void notConnected();
void notValid();
+ void notValidDerived();
void invalidAfterServiceOwnerChanged();
void introspect();
void callMethod();
@@ -219,6 +232,7 @@ void tst_QDBusInterface::notConnected()
connection);
QVERIFY(!interface.isValid());
+ QVERIFY(!QMetaObject::invokeMethod(&interface, "ListNames", Qt::DirectConnection));
}
void tst_QDBusInterface::notValid()
@@ -230,6 +244,14 @@ void tst_QDBusInterface::notValid()
connection);
QVERIFY(!interface.isValid());
+ QVERIFY(!QMetaObject::invokeMethod(&interface, "ListNames", Qt::DirectConnection));
+}
+
+void tst_QDBusInterface::notValidDerived()
+{
+ DerivedFromQDBusInterface c;
+ QVERIFY(!c.isValid());
+ QMetaObject::invokeMethod(&c, "method", Qt::DirectConnection);
}
void tst_QDBusInterface::invalidAfterServiceOwnerChanged()
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 0be4e22..30b2126 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -131,11 +131,11 @@ static QList<QByteArray> splitLines(QByteArray ba)
if (index == -1) {
continue;
}
- int end = line.indexOf('"', index + strlen(markers[j][0]) + 1);
+ int end = line.indexOf('"', index + strlen(markers[j][0]));
if (end == -1) {
continue;
}
- line.replace(index, end-index, markers[j][1]);
+ line.replace(index, end-index + 1, markers[j][1]);
}
}