From 934d8699a5e96642685502b8c82f1c6fc28365d6 Mon Sep 17 00:00:00 2001 From: Adam Endrodi Date: Thu, 28 Oct 2010 14:45:03 +0300 Subject: don't launch a new XServerPinger upon restart --- mcompositor/xserverpinger.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mcompositor/xserverpinger.cpp b/mcompositor/xserverpinger.cpp index 76897b8..654cf39 100644 --- a/mcompositor/xserverpinger.cpp +++ b/mcompositor/xserverpinger.cpp @@ -68,13 +68,20 @@ void XServerPinger::tick() qWarning("X is on holidays"); } -// Start a new process and let our parent (the real mcompositor) go. -// Die with the parent. +// Start XServerPinger in a separate process if it's not running yet. static void altmain() __attribute__((constructor)); static void altmain() { + // Don't run again if the parent restarted. + if (getenv("XSERVERPINGER")) + return; + putenv("XSERVERPINGER=1"); + + // Start a new process and let our parent (the real mcompositor) go. if (fork()) return; + + // Die with the parent. prctl(PR_SET_PDEATHSIG, SIGKILL); int meh = 0; -- cgit v1.2.3