🔧 Remove old shader if a new one is to be applied

This commit is contained in:
Simon Schneegans
2022-05-11 04:57:07 +02:00
parent 78679ef139
commit 3175c289b5
+12 -8
View File
@@ -365,12 +365,13 @@ class Extension {
return; return;
} }
// There is the weird case where an animation is already ongoing and then a // There is the weird case where an animation is already. This happens when a window
// window-open animation is requested. This happens when a window is closed which has // is closed which has been created before the session was started (e.g. when GNOME
// been created before the session was started (e.g. when GNOME Shell has been // Shell has been restarted in the meantime).
// restarted in the meantime). We do nothing in this case. const oldShader = actor.get_effect('burn-my-windows-effect');
if (forOpening && actor.get_effect('burn-my-windows-effect')) { if (oldShader) {
return; actor.remove_effect(oldShader);
oldShader.free();
} }
// ------------------------------------------------------------------ choose an effect // ------------------------------------------------------------------ choose an effect
@@ -499,8 +500,11 @@ class Extension {
// Remove the effect if the animation finished or was interrupted. // Remove the effect if the animation finished or was interrupted.
if (forOpening) { if (forOpening) {
transition.connect('stopped', () => { transition.connect('stopped', () => {
actor.remove_effect_by_name('burn-my-windows-effect'); const oldShader = actor.get_effect('burn-my-windows-effect');
shader.free(); if (oldShader) {
actor.remove_effect(oldShader);
oldShader.free();
}
}); });
} }
} }