diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-05-11 11:40:17 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-05-11 11:41:17 (GMT) |
commit | 12a1662a8cf79ff6fd7bd16ef66f7f1e77edc9e8 (patch) | |
tree | 848e54dfd0a8b36e4de488ea5591ecc8528036f6 /src/dbus | |
parent | cbfe3be00f123f3e9c4a4463f255f596cfb41ef1 (diff) | |
download | Qt-12a1662a8cf79ff6fd7bd16ef66f7f1e77edc9e8.zip Qt-12a1662a8cf79ff6fd7bd16ef66f7f1e77edc9e8.tar.gz Qt-12a1662a8cf79ff6fd7bd16ef66f7f1e77edc9e8.tar.bz2 |
Don't crash at runtime with when relaying a signal.
We have this function called qDBusInterfaceFromMetaObject that
calculates the interface name from a given meta object. There's no
need to duplicate the code here (and not do it right).
All tests still pss.
Task-number: 236955
Reviewed-by: Trust Me
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 2c27381..f40a45f 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1125,12 +1125,7 @@ void QDBusConnectionPrivate::objectDestroyed(QObject *obj) void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, int signalId, const QVariantList &args) { - int mciid = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE); - Q_ASSERT(mciid != -1); - - QMetaClassInfo mci = mo->classInfo(mciid); - Q_ASSERT(mci.value()); - const char *interface = mci.value(); + QString interface = qDBusInterfaceFromMetaObject(mo); QMetaMethod mm = mo->method(signalId); QByteArray memberName = mm.signature(); @@ -1146,12 +1141,12 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in } QDBusReadLocker locker(RelaySignalAction, this); - QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), QLatin1String(interface), + QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface, QLatin1String(memberName)); message.setArguments(args); DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); if (!msg) { - qWarning("QDBusConnection: Could not emit signal %s.%s", interface, memberName.constData()); + qWarning("QDBusConnection: Could not emit signal %s.%s", qPrintable(interface), memberName.constData()); return; } |