Force parent ListenerListInsts to rebuild.

Without this change, it is possible (and, in fact, nearly guaranteed) for lists to rebuild endlessly if a parent list is marked as needing a rebuild but never actually read. This change forces the parent list(s) to rebuild as well, resulting in a significant performance increase and smoother framerate due to greatly reduced GC activity.
This commit is contained in:
Uristqwerty 2012-12-24 20:40:09 -05:00
parent 81f0de81ea
commit 09ab39a238

View file

@ -185,6 +185,11 @@ public class ListenerList
*/ */
private void buildCache() private void buildCache()
{ {
if(parent != null && parent.shouldRebuild())
{
parent.buildCache();
}
ArrayList<IEventListener> ret = new ArrayList<IEventListener>(); ArrayList<IEventListener> ret = new ArrayList<IEventListener>();
for (EventPriority value : EventPriority.values()) for (EventPriority value : EventPriority.values())
{ {