From 17591117c1b9f7e21204def88dc874a3c6586c03 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 14 Mar 2013 13:59:30 -0400 Subject: [PATCH] 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 --- js/ui/background.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/background.js b/js/ui/background.js index bb1b2f8d0..9e3e0099d 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -407,7 +407,7 @@ const Background = new Lang.Class({ style: this._style, filename: files[i], cancellable: this._cancellable, - onFinished: Lang.bind(this, function(content) { + onFinished: Lang.bind(this, function(content, i) { numPendingImages--; if (!content) { @@ -427,7 +427,7 @@ const Background = new Lang.Class({ this._setLoaded(); this._updateAnimationProgress(); } - }) + }, i) }); } },