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.
This commit is contained in:
parent
88b6076b2f
commit
46adeb79ec
1 changed files with 10 additions and 4 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue