wayland: Move ConnectionAdaptor to the same thread as Connection

Connection deletes the ConnectionAdaptor, but they are in different
threads, which is weird.

CCBUG: 442104
This commit is contained in:
Vlad Zahorodnii 2021-09-28 18:24:12 +03:00
parent 6cf060223e
commit 6513c66ca6

View file

@ -51,10 +51,11 @@ private:
public:
ConnectionAdaptor(Connection *con)
: m_con(con)
: QObject(con)
, m_con(con)
{
connect(con, &Connection::deviceAddedSysName, this, &ConnectionAdaptor::deviceAdded, Qt::QueuedConnection);
connect(con, &Connection::deviceRemovedSysName, this, &ConnectionAdaptor::deviceRemoved, Qt::QueuedConnection);
connect(con, &Connection::deviceAddedSysName, this, &ConnectionAdaptor::deviceAdded);
connect(con, &Connection::deviceRemovedSysName, this, &ConnectionAdaptor::deviceRemoved);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin/InputDevice"),
QStringLiteral("org.kde.KWin.InputDeviceManager"),
@ -68,15 +69,12 @@ public:
}
QStringList devicesSysNames() {
// TODO: is this allowed? directly calling function of object in another thread!?
// otherwise use signal-slot mechanism
return m_con->devicesSysNames();
}
Q_SIGNALS:
void deviceAdded(QString sysName);
void deviceRemoved(QString sysName);
};
Connection *Connection::s_self = nullptr;