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 933f38390b, 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
This commit is contained in:
Florian Müllner 2014-03-14 23:57:08 +01:00
parent 30fb2b0d99
commit d6197b0904

View File

@ -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;