[effects] Clean up effect_order in unloadAllEffects

Summary:
EffectsHandlerImpl::unloadAllEffects can be very useful when writing
tests, e.g.:

    auto effectsImpl = qobect_cast<EffectsHandlerImpl *>(effects);
    QVERIFY(effectsImpl);

    effectsImpl->unloadAllEffects();
    QVERIFY(effectsImpl->loadEffect(QStringLiteral("kwin5_effect_foobar")));

but because unloadAllEffects doesn't clean up effect_order, the old
effects can be re-added back into loaded_effects when a new effect is
loaded. Such behavior can result in a segfault.

Test Plan: Existing tests pass.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17283
This commit is contained in:
Vlad Zagorodniy 2018-12-01 18:33:52 +02:00
parent 3ad9ac7229
commit 8c70600f13

View file

@ -287,8 +287,11 @@ void EffectsHandlerImpl::unloadAllEffects()
}
delete effect;
}
loaded_effects.clear();
effect_order.clear();
m_effectLoader->clear();
effectsChanged();
}
void EffectsHandlerImpl::setupAbstractClientConnections(AbstractClient* c)