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)