From b476d7f4c0acccf1c77a374eb8b14e51c2436736 Mon Sep 17 00:00:00 2001
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Date: Thu, 14 Dec 2023 10:31:03 +0200
Subject: [PATCH] plugins/screentransform: Stop tracking disabled outputs

If an output is disabled, the Output object will be kept alive. That
means that the aboutToChange connection will be kept.

If the output is enabled again and its transform changes, its contents
will be captured more than once.

In order to fix, the screentransform plugin has to break the
aboutToChange connection.
---
 src/plugins/screentransform/screentransform.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/plugins/screentransform/screentransform.cpp b/src/plugins/screentransform/screentransform.cpp
index f40a58ad43..4159bf4f43 100644
--- a/src/plugins/screentransform/screentransform.cpp
+++ b/src/plugins/screentransform/screentransform.cpp
@@ -112,6 +112,7 @@ void ScreenTransformEffect::addScreen(Output *screen)
 
 void ScreenTransformEffect::removeScreen(Output *screen)
 {
+    screen->disconnect(this);
     if (auto it = m_states.find(screen); it != m_states.end()) {
         effects->makeOpenGLContextCurrent();
         m_states.erase(it);