[helper] Terminate xclipboardsyncer if kwin_wayland goes down

Summary:
Normally the xclipboardsyncer should terminate because the socket
becomes unusable. But we have reports of it not really going down and
running amok.

In order to prevent such situations this change registers SIGTERM to be
sent to xclipboardsyncer when the parent process (that is kwin_wayland)
dies in whatever way. This ensures that xclipboardsyncer cannot become
an orphan.

BUG: 371862

Test Plan: Only compile tested, no way to get into the problematic situation

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5589
icc-effect-5.14.5
Martin Gräßlin 2017-04-26 06:57:32 +02:00
parent c3e2ea6c21
commit 572f730e8e
3 changed files with 11 additions and 0 deletions

View File

@ -313,6 +313,7 @@ check_include_files(malloc.h HAVE_MALLOC_H)
check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
check_symbol_exists(PR_SET_DUMPABLE "sys/prctl.h" HAVE_PR_SET_DUMPABLE)
check_symbol_exists(PR_SET_PDEATHSIG "sys/prctl.h" HAVE_PR_SET_PDEATHSIG)
check_include_file("sys/procctl.h" HAVE_SYS_PROCCTL_H)
check_symbol_exists(PROC_TRACE_CTL "sys/procctl.h" HAVE_PROC_TRACE_CTL)
if (HAVE_PR_SET_DUMPABLE OR HAVE_PROC_TRACE_CTL)

View File

@ -18,6 +18,7 @@
#cmakedefine01 HAVE_WAYLAND_EGL
#cmakedefine01 HAVE_SYS_PRCTL_H
#cmakedefine01 HAVE_PR_SET_DUMPABLE
#cmakedefine01 HAVE_PR_SET_PDEATHSIG
#cmakedefine01 HAVE_SYS_PROCCTL_H
#cmakedefine01 HAVE_PROC_TRACE_CTL
#cmakedefine01 HAVE_BREEZE_DECO

View File

@ -21,8 +21,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QGuiApplication>
#include <config-kwin.h>
#if HAVE_PR_SET_PDEATHSIG
#include <sys/prctl.h>
#include <signal.h>
#endif
int main(int argc, char *argv[])
{
#if HAVE_PR_SET_PDEATHSIG
prctl(PR_SET_PDEATHSIG, SIGTERM);
#endif
qputenv("QT_QPA_PLATFORM", "xcb");
QGuiApplication app(argc, argv);
// perform sanity checks