Use QPointer to monitor input method server connection.

Input method may crash and leave a dangling pointer. DBus interface may
access the invalid pointer and crash kwin.
This commit is contained in:
Weng Xuetian 2021-12-13 09:29:16 -08:00 committed by Aleix Pol Gonzalez
parent d66be7b99f
commit 7a270b5d78
2 changed files with 7 additions and 4 deletions

View file

@ -206,6 +206,11 @@ KWaylandServer::ClientConnection *WaylandServer::xWaylandConnection() const
return m_xwaylandConnection;
}
KWaylandServer::ClientConnection *WaylandServer::inputMethodConnection() const
{
return m_inputMethodServerConnection;
}
void WaylandServer::registerShellClient(AbstractClient *client)
{
if (client->isLockScreen()) {

View file

@ -180,9 +180,7 @@ public:
void initWorkspace();
KWaylandServer::ClientConnection *xWaylandConnection() const;
KWaylandServer::ClientConnection *inputMethodConnection() const {
return m_inputMethodServerConnection;
}
KWaylandServer::ClientConnection *inputMethodConnection() const;
KWaylandServer::ClientConnection *screenLockerClientConnection() const {
return m_screenLockerClientConnection;
}
@ -266,7 +264,7 @@ private:
QSet<KWaylandServer::LinuxDmaBufV1ClientBuffer*> m_linuxDmabufBuffers;
QPointer<KWaylandServer::ClientConnection> m_xwaylandConnection;
KWaylandServer::InputMethodV1Interface *m_inputMethod = nullptr;
KWaylandServer::ClientConnection *m_inputMethodServerConnection = nullptr;
QPointer<KWaylandServer::ClientConnection> m_inputMethodServerConnection;
KWaylandServer::ClientConnection *m_screenLockerClientConnection = nullptr;
KWaylandServer::XdgForeignV2Interface *m_XdgForeign = nullptr;
KWaylandServer::KeyStateInterface *m_keyState = nullptr;