[gnome-shell] background: Clarify the intent of the code



commit 5262a4161993e50d046a0c770b52413ac9c36015
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Dec 3 18:08:42 2013 -0500

    background: Clarify the intent of the code
    
    Stomping on local variables and trying to keep loop state isn't
    too fun. Just use a new variable here so we aren't too confused
    with what we're doing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719803

 js/ui/background.js |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/background.js b/js/ui/background.js
index 79e58a7..1d9f55c 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -183,13 +183,16 @@ const BackgroundCache = new Lang.Class({
 
                                                   for (let j = 0; j < pendingLoad.callers.length; j++) {
                                                       if (pendingLoad.callers[j].onFinished) {
-                                                          if (content && pendingLoad.callers[j].shouldCopy) {
-                                                              content = 
object.copy(pendingLoad.callers[j].monitorIndex,
-                                                                                    
pendingLoad.callers[j].effects);
+                                                          let newContent;
 
+                                                          if (content && pendingLoad.callers[j].shouldCopy) {
+                                                              newContent = 
content.copy(pendingLoad.callers[j].monitorIndex,
+                                                                                        
pendingLoad.callers[j].effects);
+                                                          } else {
+                                                              newContent = content;
                                                           }
 
-                                                          pendingLoad.callers[j].onFinished(content);
+                                                          pendingLoad.callers[j].onFinished(newContent);
                                                       }
                                                   }
 


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