[gnome-shell/gnome-3-2] iconGrid: avoid recreating icons unnecessarily



commit a5324462c35ebb15651f1bb951543cc4c688f831
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Jan 16 17:28:40 2012 -0500

    iconGrid: avoid recreating icons unnecessarily
    
    Add a short-circuit when the size doesn't change. Taken from part
    of 26580f8f2c (Giovanni Campagna). This greatly reduces the reentrancy
    of recreating icons that seems to be responsible for many crashers,
    though the exact mechanism for the crashes isn't clear. See:
    
    https://bugzilla.gnome.org/show_bug.cgi?id=648450
    https://bugzilla.redhat.com/show_bug.cgi?id=707652
    https://bugzilla.redhat.com/show_bug.cgi?id=781780

 js/ui/iconGrid.js |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 765bd2b..e65f966 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -147,6 +147,11 @@ BaseIcon.prototype = {
             size = found ? len : ICON_SIZE;
         }
 
+        // don't create icons unnecessarily
+        if (size == this.iconSize &&
+            this._iconBin.child)
+            return;
+
         this._createIconTexture(size);
     }
 };



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