From 0ad6811684b38e0278d5310ca229e2fcc9ae4ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 13 Nov 2013 10:03:58 +0100 Subject: [PATCH] [kwin] Fix crash in tear-down of EffectsHandlerImpl Adding a simplified logic to unload all effects directly in the dtor. Looks like Qt didn't like our double traversal over the list any more and was causing double deletions. --- effects.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/effects.cpp b/effects.cpp index f945476f86..3fd9745a09 100644 --- a/effects.cpp +++ b/effects.cpp @@ -261,8 +261,21 @@ EffectsHandlerImpl::~EffectsHandlerImpl() { if (keyboard_grab_effect != NULL) ungrabKeyboard(); - for (const EffectPair & ep : loaded_effects) - unloadEffect(ep.first); + setActiveFullScreenEffect(nullptr); + for (auto it = loaded_effects.begin(); it != loaded_effects.end(); ++it) { + const QString &name = (*it).first; + Effect *effect = (*it).second; + stopMouseInterception(effect); + // remove support properties for the effect + const QList properties = m_propertiesForEffects.keys(); + for (const QByteArray &property : properties) { + removeSupportProperty(property, effect); + } + delete effect; + if (effect_libraries.contains(name)) { + effect_libraries[ name ]->unload(); + } + } } void EffectsHandlerImpl::setupClientConnections(Client* c)