Skip to content
Commit eb6e2619 authored by Jiří Paleček's avatar Jiří Paleček Committed by David Edmundson
Browse files

Sanitize signal handling in ksmserver

Summary:
The TERM signal handling in ksmserver invokes functions which are not async-signal safe, like Qt functions and C++ destructors. Moreover, the signal handling can occur in other than the main thread, which leads to Qt complaining about  functions being invoked from the wrong thread. Such a crash can be seen in a report of [[ bug 384316 |https://bugs.kde.org/show_bug.cgi?id=384316 ]].

To fix both of these issues, this change makes the signal handling use the self-pipe trick, which signals the need for termination to the main thread by writing to a special-purpose file descriptor. The main loop then takes care of the termination. This is mostly inspired by [[ http://doc.qt.io/qt-5/unix-signals.html ]].

Note that `QApplication::quit` already does what we need when destroying the server, particularly deleting `the_server`/calling `cleanUp()`.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: broulik, graesslin, davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8673
parent 28ddeb27
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