background: Fix updating existing images that need loading

Due to weird and strange JS scoping semantics, if we are in a
callback, "i" won't be captured and when the callback is called,
we'll have the wrong index, causing addImage to be called instead
of updateImage.

https://bugzilla.gnome.org/show_bug.cgi?id=695882
This commit is contained in:
Jasper St. Pierre 2013-03-14 13:59:30 -04:00
parent c4470fd1e6
commit 17591117c1

View File

@ -407,7 +407,7 @@ const Background = new Lang.Class({
style: this._style, style: this._style,
filename: files[i], filename: files[i],
cancellable: this._cancellable, cancellable: this._cancellable,
onFinished: Lang.bind(this, function(content) { onFinished: Lang.bind(this, function(content, i) {
numPendingImages--; numPendingImages--;
if (!content) { if (!content) {
@ -427,7 +427,7 @@ const Background = new Lang.Class({
this._setLoaded(); this._setLoaded();
this._updateAnimationProgress(); this._updateAnimationProgress();
} }
}) }, i)
}); });
} }
}, },