Fix up possible CME

This commit is contained in:
Christian 2014-05-13 15:11:50 -04:00
parent 8a69b17bd6
commit e05d6340d7

View file

@ -1,11 +1,12 @@
package cpw.mods.fml.common.eventhandler;
import java.util.*;
import com.google.common.collect.ImmutableList;
public class ListenerList
{
private static ArrayList<ListenerList> allLists = new ArrayList<ListenerList>();
private static ImmutableList<ListenerList> allLists = ImmutableList.of();
private static int maxSize = 0;
private ListenerList parent;
@ -13,15 +14,22 @@ public class ListenerList
public ListenerList()
{
allLists.add(this);
extendMasterList(this);
resizeLists(maxSize);
}
public ListenerList(ListenerList parent)
{
allLists.add(this);
this();
this.parent = parent;
resizeLists(maxSize);
}
private synchronized static void extendMasterList(ListenerList inst)
{
ImmutableList.Builder<ListenerList> builder = ImmutableList.builder();
builder.addAll(allLists);
builder.add(inst);
allLists = builder.build();
}
public static void resize(int max)