Remove the default address parameter from QDBusServer's constructor.
Commit 5be6cf0a6e306ed3a51ed5ba89317b1317544eea introduced an implicit cast from const char* to QString in QDBusServer's constructor, which breaks the compilation of applications which use QtDBus when QT_NO_CAST_FROM_ASCII is defined and clang is used. Fix it by splitting the current constructor with the broken default argument into one which takes a non-default QString and one which only takes a QObject* parent and calls the other with the current default argument. It would have been better not to have mostly duplicate code in both constructors, but QDBusConnectionPrivate is also used in other places. Task-number: QTBUG-23398 Change-Id: Ia001d63878e7ff720c6630a3372adc571124448d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
314da0ae01
commit
3de1e6f26b
|
|
@ -81,6 +81,31 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent)
|
|||
d->setServer(q_dbus_server_listen(address.toUtf8().constData(), error), error);
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a QDBusServer with the given \a parent. The server will listen
|
||||
for connections in \c {/tmp}.
|
||||
*/
|
||||
QDBusServer::QDBusServer(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
const QString address = QLatin1String("unix:tmpdir=/tmp");
|
||||
|
||||
if (!qdbus_loadLibDBus()) {
|
||||
d = 0;
|
||||
return;
|
||||
}
|
||||
d = new QDBusConnectionPrivate(this);
|
||||
|
||||
QMutexLocker locker(&QDBusConnectionManager::instance()->mutex);
|
||||
QDBusConnectionManager::instance()->setConnection(QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(d)), d);
|
||||
|
||||
QObject::connect(d, SIGNAL(newServerConnection(QDBusConnection)),
|
||||
this, SIGNAL(newConnection(QDBusConnection)));
|
||||
|
||||
QDBusErrorInternal error;
|
||||
d->setServer(q_dbus_server_listen(address.toUtf8().constData(), error), error);
|
||||
}
|
||||
|
||||
/*!
|
||||
Destructs a QDBusServer
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ class Q_DBUS_EXPORT QDBusServer: public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDBusServer(const QString &address = "unix:tmpdir=/tmp", QObject *parent = 0);
|
||||
explicit QDBusServer(const QString &address, QObject *parent = 0);
|
||||
explicit QDBusServer(QObject *parent = 0);
|
||||
virtual ~QDBusServer();
|
||||
|
||||
bool isConnected() const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue