[gnome-shell] background: Destroy redundant backgrounds right after loading



commit d6197b0904fa336afcb2b927b22a60c27592b80a
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Mar 14 23:57:08 2014 +0100

    background: Destroy redundant backgrounds right after loading
    
    When reacting to background settings changes, we may end up queuing
    more than one load. The redundant backgrounds are expected to be
    destroyed when the previous background has faded out; however since
    commit 933f38390ba1512aa, the tweened actor is the same for all
    consecutive load operations and we end up with a single onComplete
    handler, ergo a single destroyed actor.
    As new backgrounds are always added to the bottom, we are not only
    piling up additional background actors, but break changing backgrounds
    more than once, as the correct background ends up being covered by
    previously added redundant actors.
    Fix this by destroying redundant actors right after loading rather
    than waiting for the fade animation to complete.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726120

 js/ui/background.js |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/background.js b/js/ui/background.js
index b1eb57a..d36aeb1 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -754,17 +754,18 @@ const BackgroundManager = new Lang.Class({
             Lang.bind(this, function() {
                 newBackground.disconnect(newBackground.loadedSignalId);
                 newBackground.loadedSignalId = 0;
+
+                if (this._newBackground != newBackground) {
+                    /* Not interesting, we queued another load */
+                    newBackground.actor.destroy();
+                    return;
+                }
+
                 Tweener.addTween(this.background.actor,
                                  { opacity: 0,
                                    time: FADE_ANIMATION_TIME,
                                    transition: 'easeOutQuad',
                                    onComplete: Lang.bind(this, function() {
-                                       if (this._newBackground != newBackground) {
-                                           /* Not interesting, we queued another load */
-                                           newBackground.actor.destroy();
-                                           return;
-                                       }
-
                                        this.background.actor.destroy();
                                        this.background = newBackground;
                                        this._newBackground = null;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]