summaryrefslogtreecommitdiffstats
path: root/src/dbus
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-09 11:03:54 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-07-09 11:03:54 (GMT)
commit8bc84e2180e1d5819b372f4cd8c236b853145803 (patch)
tree6c5e6a8b6a1750e2484fd34f48be662fcf51959f /src/dbus
parentd641198fa71fadd243e84dfdf02b9a0536a27b3f (diff)
parent3b1e30bb1d6651a626aba1f6b8883f5524598ed3 (diff)
downloadQt-8bc84e2180e1d5819b372f4cd8c236b853145803.zip
Qt-8bc84e2180e1d5819b372f4cd8c236b853145803.tar.gz
Qt-8bc84e2180e1d5819b372f4cd8c236b853145803.tar.bz2
Merge commit 'origin/master' into 4.6-merged
Conflicts: src/corelib/kernel/qcoreevent.cpp src/corelib/tools/qdumper.cpp src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget_p.h src/gui/kernel/qwidget_s60.cpp src/gui/text/qfontdatabase.cpp src/network/access/qnetworkreplyimpl.cpp src/sql/drivers/ibase/qsql_ibase.cpp src/testlib/qtestcase.cpp src/testlib/testlib.pro tests/auto/network-settings.h tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp tests/auto/qobjectrace/tst_qobjectrace.cpp tests/auto/qsqldatabase/tst_qsqldatabase.cpp tools/configure/configureapp.cpp translations/qt_ru.ts
Diffstat (limited to 'src/dbus')
-rw-r--r--src/dbus/qdbusconnection.cpp7
-rw-r--r--src/dbus/qdbusmessage.cpp19
2 files changed, 21 insertions, 5 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 6777aa5..14cadd9 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -973,8 +973,15 @@ QDBusConnection QDBusConnection::systemBus()
}
/*!
+ \nonreentrant
+
Returns the connection that sent the signal, if called in a slot activated
by QDBus; otherwise it returns 0.
+
+ \note Please avoid this function. This function is not thread-safe, so if
+ there's any other thread delivering a D-Bus call, this function may return
+ the wrong connection. In new code, please use QDBusContext::connection()
+ (see that class for a description on how to use it).
*/
QDBusConnection QDBusConnection::sender()
{
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 47dd34b..9150295 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -108,8 +108,11 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
//qDebug() << "QDBusMessagePrivate::toDBusMessage" << "message is invalid";
break;
case DBUS_MESSAGE_TYPE_METHOD_CALL:
- msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), data(d_ptr->path.toUtf8()),
- data(d_ptr->interface.toUtf8()), data(d_ptr->name.toUtf8()));
+ // only interface can be empty
+ if (d_ptr->service.isEmpty() || d_ptr->path.isEmpty() || d_ptr->name.isEmpty())
+ break;
+ msg = q_dbus_message_new_method_call(d_ptr->service.toUtf8(), d_ptr->path.toUtf8(),
+ data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8());
break;
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
@@ -119,16 +122,22 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
+ // error name can't be empty
+ if (d_ptr->name.isEmpty())
+ break;
msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR);
- q_dbus_message_set_error_name(msg, data(d_ptr->name.toUtf8()));
+ q_dbus_message_set_error_name(msg, d_ptr->name.toUtf8());
if (!d_ptr->localMessage) {
q_dbus_message_set_destination(msg, q_dbus_message_get_sender(d_ptr->reply));
q_dbus_message_set_reply_serial(msg, q_dbus_message_get_serial(d_ptr->reply));
}
break;
case DBUS_MESSAGE_TYPE_SIGNAL:
- msg = q_dbus_message_new_signal(data(d_ptr->path.toUtf8()), data(d_ptr->interface.toUtf8()),
- data(d_ptr->name.toUtf8()));
+ // nothing can be empty here
+ if (d_ptr->path.isEmpty() || d_ptr->interface.isEmpty() || d_ptr->name.isEmpty())
+ break;
+ msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(),
+ d_ptr->name.toUtf8());
break;
default:
Q_ASSERT(false);