Commit 4eaf4f02 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

input methods: improve closing process

Make sure it's destroyed when kwin shuts down, make sure we don't start
it, for example because it crashed when we killed it like maliit does.


(cherry picked from commit 46adeb79)
parent b51a6a14
......@@ -119,7 +119,6 @@ ApplicationWayland::ApplicationWayland(int &argc, char **argv)
connect(&m_inputMethodCrashTimer, &QTimer::timeout, this, [this] {
m_inputMethodCrashes = 0;
});
connect(waylandServer(), &WaylandServer::terminatingInternalClientConnection, this, &ApplicationWayland::stopInputMethod);
}
ApplicationWayland::~ApplicationWayland()
......@@ -230,8 +229,13 @@ void ApplicationWayland::stopInputMethod()
if (!m_inputMethodProcess) {
return;
}
m_inputMethodProcess->kill();
m_inputMethodProcess->waitForFinished();
disconnect(m_inputMethodProcess, nullptr, this, nullptr);
m_inputMethodProcess->terminate();
if (!m_inputMethodProcess->waitForFinished()) {
m_inputMethodProcess->kill();
m_inputMethodProcess->waitForFinished();
}
if (waylandServer()) {
waylandServer()->destroyInputMethodConnection();
}
......@@ -242,10 +246,12 @@ void ApplicationWayland::stopInputMethod()
void ApplicationWayland::startInputMethod(const QString &executable)
{
stopInputMethod();
if (executable.isEmpty()) {
if (executable.isEmpty() || isTerminating()) {
return;
}
connect(waylandServer(), &WaylandServer::terminatingInternalClientConnection, this, &ApplicationWayland::stopInputMethod, Qt::UniqueConnection);
QStringList arguments = KShell::splitArgs(executable);
if (arguments.isEmpty()) {
qWarning("Failed to launch the input method server: %s is an invalid command", qPrintable(m_inputMethodServerToStart));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment