From 32daab286d10e700e918cfb2f46df5759b3ba7e8 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Fri, 4 Mar 2022 22:18:51 +0100 Subject: [PATCH] Use workspaceLayer as context object Otherwise the connection isn't severed when the layer is destroyed, leading to crashes when screen resolution changes. We don't actually need `this` to access `workspace()`, and we have a guarded `output` as sender in the other case. --- src/composite.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/composite.cpp b/src/composite.cpp index eba2cca2d3..ac0629a3b0 100644 --- a/src/composite.cpp +++ b/src/composite.cpp @@ -365,7 +365,7 @@ void Compositor::startupWithWorkspace() auto workspaceLayer = new RenderLayer(outputs.constFirst()->renderLoop()); workspaceLayer->setDelegate(new SceneDelegate(m_scene)); workspaceLayer->setGeometry(workspace()->geometry()); - connect(workspace(), &Workspace::geometryChanged, this, [workspaceLayer]() { + connect(workspace(), &Workspace::geometryChanged, workspaceLayer, [workspaceLayer]() { workspaceLayer->setGeometry(workspace()->geometry()); }); addSuperLayer(workspaceLayer); @@ -424,7 +424,7 @@ void Compositor::addOutput(AbstractOutput *output) auto workspaceLayer = new RenderLayer(output->renderLoop()); workspaceLayer->setDelegate(new SceneDelegate(m_scene, output)); workspaceLayer->setGeometry(output->geometry()); - connect(output, &AbstractOutput::geometryChanged, this, [output, workspaceLayer]() { + connect(output, &AbstractOutput::geometryChanged, workspaceLayer, [output, workspaceLayer]() { workspaceLayer->setGeometry(output->geometry()); });