[wayland] Destroy input method connection after process finished

More cleanup.
This commit is contained in:
Martin Gräßlin 2015-11-10 14:38:45 +01:00
parent 0bf51d99f6
commit fa6fbbdfc1
3 changed files with 23 additions and 1 deletions

View file

@ -188,6 +188,15 @@ void ApplicationWayland::continueStartupWithX()
environment.remove("DISPLAY");
environment.remove("WAYLAND_DISPLAY");
QProcess *p = new QProcess(this);
auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished);
connect(p, finishedSignal, this,
[this, p] {
if (waylandServer()) {
waylandServer()->destroyInputMethodConnection();
}
p->deleteLater();
}
);
p->setProcessEnvironment(environment);
p->start(m_inputMethodServerToStart);
p->waitForStarted();

View file

@ -71,7 +71,10 @@ WaylandServer::WaylandServer(QObject *parent)
qRegisterMetaType<KWayland::Server::OutputInterface::DpmsMode>();
}
WaylandServer::~WaylandServer() = default;
WaylandServer::~WaylandServer()
{
destroyInputMethodConnection();
}
void WaylandServer::destroyInternalConnection()
{
@ -292,6 +295,15 @@ int WaylandServer::createInputMethodConnection()
return sx[1];
}
void WaylandServer::destroyInputMethodConnection()
{
if (!m_inputMethodServerConnection) {
return;
}
m_inputMethodServerConnection->destroy();
m_inputMethodServerConnection = nullptr;
}
void WaylandServer::createInternalConnection()
{
int sx[2];

View file

@ -115,6 +115,7 @@ public:
* @returns file descriptor to the input method server's socket.
**/
int createInputMethodConnection();
void destroyInputMethodConnection();
void createInternalConnection();
void destroyInternalConnection();