From bd5c566399bb8f1432c4bd94f73be71cefad8675 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 22 Nov 2023 09:59:42 +0200 Subject: [PATCH] plugins/screentransform: Avoid mangling with opengl context when a screen is removed For the most part, the screen transform effect is inactive. So if a screen is removed, it's likely that m_states contains no entry for it. --- src/plugins/screentransform/screentransform.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/screentransform/screentransform.cpp b/src/plugins/screentransform/screentransform.cpp index dea933774a..6bbd6a2f2a 100644 --- a/src/plugins/screentransform/screentransform.cpp +++ b/src/plugins/screentransform/screentransform.cpp @@ -116,9 +116,10 @@ void ScreenTransformEffect::addScreen(Output *screen) void ScreenTransformEffect::removeScreen(Output *screen) { - effects->makeOpenGLContextCurrent(); - m_states.remove(screen); - effects->doneOpenGLContextCurrent(); + if (auto it = m_states.find(screen); it != m_states.end()) { + effects->makeOpenGLContextCurrent(); + m_states.erase(it); + } } void ScreenTransformEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime)