[wayland] Destroy Xwayland's ClientConnection on tear down
We need to destroy the ClientConnections we create. Also we need to disconnect our Xwayland error handling before destroying it, otherwise it would trigger the abort for crashing Xwayland.
This commit is contained in:
parent
f75e53af60
commit
affcbac7e7
4 changed files with 21 additions and 5 deletions
|
@ -61,6 +61,7 @@ WaylandTestApplication::~WaylandTestApplication()
|
||||||
if (m_xwaylandProcess) {
|
if (m_xwaylandProcess) {
|
||||||
m_xwaylandProcess->terminate();
|
m_xwaylandProcess->terminate();
|
||||||
m_xwaylandProcess->waitForFinished();
|
m_xwaylandProcess->waitForFinished();
|
||||||
|
waylandServer()->destroyXWaylandConnection();
|
||||||
}
|
}
|
||||||
waylandServer()->destroyInternalConnection();
|
waylandServer()->destroyInternalConnection();
|
||||||
destroyCompositor();
|
destroyCompositor();
|
||||||
|
|
|
@ -85,6 +85,7 @@ ApplicationWayland::~ApplicationWayland()
|
||||||
if (m_xwaylandProcess) {
|
if (m_xwaylandProcess) {
|
||||||
m_xwaylandProcess->terminate();
|
m_xwaylandProcess->terminate();
|
||||||
m_xwaylandProcess->waitForFinished();
|
m_xwaylandProcess->waitForFinished();
|
||||||
|
waylandServer()->destroyXWaylandConnection();
|
||||||
}
|
}
|
||||||
waylandServer()->destroyInternalConnection();
|
waylandServer()->destroyInternalConnection();
|
||||||
destroyCompositor();
|
destroyCompositor();
|
||||||
|
|
|
@ -125,7 +125,7 @@ void WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
|
||||||
// it's possible that a Surface gets created before Workspace is created
|
// it's possible that a Surface gets created before Workspace is created
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (surface->client() == m_xwaylandConnection) {
|
if (surface->client() == m_xwayland.client) {
|
||||||
// skip Xwayland clients, those are created using standard X11 way
|
// skip Xwayland clients, those are created using standard X11 way
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -261,8 +261,8 @@ int WaylandServer::createXWaylandConnection()
|
||||||
qCWarning(KWIN_CORE) << "Could not create socket";
|
qCWarning(KWIN_CORE) << "Could not create socket";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
m_xwaylandConnection = m_display->createClient(sx[0]);
|
m_xwayland.client = m_display->createClient(sx[0]);
|
||||||
connect(m_xwaylandConnection, &KWayland::Server::ClientConnection::disconnected, this,
|
m_xwayland.destroyConnection = connect(m_xwayland.client, &KWayland::Server::ClientConnection::disconnected, this,
|
||||||
[] {
|
[] {
|
||||||
qFatal("Xwayland Connection died");
|
qFatal("Xwayland Connection died");
|
||||||
}
|
}
|
||||||
|
@ -270,6 +270,16 @@ int WaylandServer::createXWaylandConnection()
|
||||||
return sx[1];
|
return sx[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaylandServer::destroyXWaylandConnection()
|
||||||
|
{
|
||||||
|
if (!m_xwayland.client) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
disconnect(m_xwayland.destroyConnection);
|
||||||
|
m_xwayland.client->destroy();
|
||||||
|
m_xwayland.client = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int WaylandServer::createInputMethodConnection()
|
int WaylandServer::createInputMethodConnection()
|
||||||
{
|
{
|
||||||
int sx[2];
|
int sx[2];
|
||||||
|
|
|
@ -109,6 +109,7 @@ public:
|
||||||
* @returns file descriptor for Xwayland to connect to.
|
* @returns file descriptor for Xwayland to connect to.
|
||||||
**/
|
**/
|
||||||
int createXWaylandConnection();
|
int createXWaylandConnection();
|
||||||
|
void destroyXWaylandConnection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns file descriptor to the input method server's socket.
|
* @returns file descriptor to the input method server's socket.
|
||||||
|
@ -120,7 +121,7 @@ public:
|
||||||
void initWorkspace();
|
void initWorkspace();
|
||||||
|
|
||||||
KWayland::Server::ClientConnection *xWaylandConnection() const {
|
KWayland::Server::ClientConnection *xWaylandConnection() const {
|
||||||
return m_xwaylandConnection;
|
return m_xwayland.client;
|
||||||
}
|
}
|
||||||
KWayland::Server::ClientConnection *inputMethodConnection() const {
|
KWayland::Server::ClientConnection *inputMethodConnection() const {
|
||||||
return m_inputMethodServerConnection;
|
return m_inputMethodServerConnection;
|
||||||
|
@ -156,7 +157,10 @@ private:
|
||||||
KWayland::Server::PlasmaShellInterface *m_plasmaShell = nullptr;
|
KWayland::Server::PlasmaShellInterface *m_plasmaShell = nullptr;
|
||||||
KWayland::Server::PlasmaWindowManagementInterface *m_windowManagement = nullptr;
|
KWayland::Server::PlasmaWindowManagementInterface *m_windowManagement = nullptr;
|
||||||
KWayland::Server::QtSurfaceExtensionInterface *m_qtExtendedSurface = nullptr;
|
KWayland::Server::QtSurfaceExtensionInterface *m_qtExtendedSurface = nullptr;
|
||||||
KWayland::Server::ClientConnection *m_xwaylandConnection = nullptr;
|
struct {
|
||||||
|
KWayland::Server::ClientConnection *client = nullptr;
|
||||||
|
QMetaObject::Connection destroyConnection;
|
||||||
|
} m_xwayland;
|
||||||
KWayland::Server::ClientConnection *m_inputMethodServerConnection = nullptr;
|
KWayland::Server::ClientConnection *m_inputMethodServerConnection = nullptr;
|
||||||
KWayland::Server::ClientConnection *m_screenLockerClientConnection = nullptr;
|
KWayland::Server::ClientConnection *m_screenLockerClientConnection = nullptr;
|
||||||
struct {
|
struct {
|
||||||
|
|
Loading…
Reference in a new issue