Skip to content
  • Jiří Paleček's avatar
    Sanitize signal handling in ksmserver · eb6e2619
    Jiří Paleček authored and David Edmundson's avatar David Edmundson committed
    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
    eb6e2619