From df2c26e3d9a2c3e95e0bd3def290c564ff62a278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 14 Apr 2016 08:51:16 +0200 Subject: [PATCH] Only start Xwayland server if Compositor created a Scene So far if the Scene creation failed kwin_wayland went into a shutdown, but didn't succeed because the thread to start Xwayland was already running: it froze. This change introduces a new signal in Compositor: sceneCreated. The startup of Xwayland is bound to this signal. If it gets fired KWin can startup Xwayland. If it does not get fired, KWin terminates correctly. --- composite.cpp | 1 + composite.h | 1 + main_wayland.cpp | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/composite.cpp b/composite.cpp index dab48f4caf..66ac47f320 100644 --- a/composite.cpp +++ b/composite.cpp @@ -278,6 +278,7 @@ void Compositor::slotCompositingOptionsInitialized() } return; } + emit sceneCreated(); if (Workspace::self()) { startupWithWorkspace(); diff --git a/composite.h b/composite.h index fc0ddd5288..50134cb18f 100644 --- a/composite.h +++ b/composite.h @@ -186,6 +186,7 @@ public Q_SLOTS: Q_SIGNALS: void compositingToggled(bool active); void aboutToDestroy(); + void sceneCreated(); protected: void timerEvent(QTimerEvent *te); diff --git a/main_wayland.cpp b/main_wayland.cpp index c9ee426150..6bcbe182ae 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "main_wayland.h" +#include "composite.h" #include "workspace.h" #include // kwin @@ -152,8 +153,7 @@ void ApplicationWayland::continueStartupWithScreens() return; } createCompositor(); - - startXwaylandServer(); + connect(Compositor::self(), &Compositor::sceneCreated, this, &ApplicationWayland::startXwaylandServer); } void ApplicationWayland::continueStartupWithX() @@ -280,6 +280,7 @@ void ApplicationWayland::createX11Connection() void ApplicationWayland::startXwaylandServer() { + disconnect(Compositor::self(), &Compositor::sceneCreated, this, &ApplicationWayland::startXwaylandServer); int pipeFds[2]; if (pipe(pipeFds) != 0) { std::cerr << "FATAL ERROR failed to create pipe to start Xwayland " << std::endl;