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
This commit is contained in:
Owen W. Taylor 2012-01-16 17:28:40 -05:00
parent 7e654ab3ca
commit a5324462c3

View File

@ -147,6 +147,11 @@ BaseIcon.prototype = {
size = found ? len : ICON_SIZE; size = found ? len : ICON_SIZE;
} }
// don't create icons unnecessarily
if (size == this.iconSize &&
this._iconBin.child)
return;
this._createIconTexture(size); this._createIconTexture(size);
} }
}; };