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.
This commit is contained in:
Martin Gräßlin 2016-04-14 08:51:16 +02:00
parent 0df4406c2c
commit df2c26e3d9
3 changed files with 5 additions and 2 deletions

View file

@ -278,6 +278,7 @@ void Compositor::slotCompositingOptionsInitialized()
}
return;
}
emit sceneCreated();
if (Workspace::self()) {
startupWithWorkspace();

View file

@ -186,6 +186,7 @@ public Q_SLOTS:
Q_SIGNALS:
void compositingToggled(bool active);
void aboutToDestroy();
void sceneCreated();
protected:
void timerEvent(QTimerEvent *te);

View file

@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "main_wayland.h"
#include "composite.h"
#include "workspace.h"
#include <config-kwin.h>
// 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;