[gnome-shell] background: Fix updating existing images that need loading



commit 17591117c1b9f7e21204def88dc874a3c6586c03
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Mar 14 13:59:30 2013 -0400

    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 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/background.js b/js/ui/background.js
index bb1b2f8..9e3e009 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)
                                         });
         }
     },


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