effect/effecthandler: prevent dangling pointers when unloading effects
When effects get deleted, they might call EffectsHandler::isColorPickerActive, which checks the list of loaded effects. With the previous code, that would access the already-deleted effects in the list, leading to crashes like https://crash-reports.kde.org/organizations/kde/issues/37390/
To fix that, this commit moves things around so that effets lists are cleared first, and effects are only deleted afterwards.
(cherry picked from commit 1eb926d7)
Co-authored-by: Xaver Hugl xaver.hugl@gmail.com