[effects] Clean up effect_order in unloadAllEffects
ClosedPublic

Authored by zzag on Dec 1 2018, 4:59 PM.

Details

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.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Dec 1 2018, 4:59 PM
Restricted Application added a project: KWin. · View Herald TranscriptDec 1 2018, 4:59 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Dec 1 2018, 4:59 PM
graesslin accepted this revision.Dec 1 2018, 5:05 PM
This revision is now accepted and ready to land.Dec 1 2018, 5:05 PM
This revision was automatically updated to reflect the committed changes.