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:
parent
30fb2b0d99
commit
d6197b0904
@ -754,17 +754,18 @@ const BackgroundManager = new Lang.Class({
|
|||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
newBackground.disconnect(newBackground.loadedSignalId);
|
newBackground.disconnect(newBackground.loadedSignalId);
|
||||||
newBackground.loadedSignalId = 0;
|
newBackground.loadedSignalId = 0;
|
||||||
|
|
||||||
|
if (this._newBackground != newBackground) {
|
||||||
|
/* Not interesting, we queued another load */
|
||||||
|
newBackground.actor.destroy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Tweener.addTween(this.background.actor,
|
Tweener.addTween(this.background.actor,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: FADE_ANIMATION_TIME,
|
time: FADE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: Lang.bind(this, function() {
|
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.actor.destroy();
|
||||||
this.background = newBackground;
|
this.background = newBackground;
|
||||||
this._newBackground = null;
|
this._newBackground = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user