diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-12-11 14:37:11 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-12-20 07:36:42 +0100 |
commit | 7b6ab50c68e771ecbd350b58890fae0e58330e9f (patch) | |
tree | 37fe8ff6332892aa3edd8213b15afcc6dd0dc170 /src/dbus/qdbusserver.cpp | |
parent | 9434162eda4d0ffe5f5f8571ff7330a71df0d0e2 (diff) | |
download | qtbase-7b6ab50c68e771ecbd350b58890fae0e58330e9f.tar.gz |
Remove the hardcoding of Unix socket paths for QtDBus
This allows the tests to be run on Windows too by using TCP socket
connections instead of requiring Unix sockets. The tests shouldn't have
hardcoded the path, which came from QDBusServer anyway. Now the tests
simply defer to QDBusServer.
This is a slight behavior change for Windows, but not one that should
matter since anyone who was using the default constructor resulted in a
QDBusServer that failed to listen.
[ChangeLog][QtDBus][QDBusServer] Fixed a bug that made QDBusServer's
default constructor try to bind to a Unix socket on non-Unix systems.
Now QDBusServer will attempt to bind to a TCP socket instead.
Change-Id: I2a126019671c2d90257e739ed3aff7938d1fe946
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/dbus/qdbusserver.cpp')
-rw-r--r-- | src/dbus/qdbusserver.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index f2f4872aa0..54b38ee848 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -72,12 +72,18 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent) /*! Constructs a QDBusServer with the given \a parent. The server will listen - for connections in \c {/tmp}. + for connections in \c {/tmp} (on Unix systems) or on a TCP port bound to + localhost (elsewhere). */ QDBusServer::QDBusServer(QObject *parent) : QObject(parent) { - const QString address = QLatin1String("unix:tmpdir=/tmp"); +#ifdef Q_OS_UNIX + // Use Unix sockets on Unix systems only + static const char address[] = "unix:tmpdir=/tmp"; +#else + static const char address[] = "tcp:"; +#endif if (!qdbus_loadLibDBus()) { d = 0; @@ -89,7 +95,7 @@ QDBusServer::QDBusServer(QObject *parent) this, SIGNAL(newConnection(QDBusConnection))); QDBusErrorInternal error; - d->setServer(q_dbus_server_listen(address.toUtf8().constData(), error), error); + d->setServer(q_dbus_server_listen(address, error), error); } /*! |