Fixed memory leak on the client caused by Netty holding references to the World. Closes #415 #417

This commit is contained in:
Lex Manos committed 2014-05-05 22:14:13 -07:00
1 parent b84d0760ae
commit 251af1d09d
3 files changed
+24 -7

No files matched your search

@@ -14,6 +14,7 @@ package cpw.mods.fml.client;
import java.io.File;
import java.io.FileInputStream;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -161,7 +162,7 @@ public class FMLClientHandler implements IFMLSidedHandler
private Map<ServerStatusResponse,JsonObject> extraServerListData;
private Map<ServerData, ExtendedServerListData> serverDataTag;
private NetHandlerPlayClient currentPlayClient;
private WeakReference<NetHandlerPlayClient> currentPlayClient;
/**
* Called to start the whole game off
@@ -596,7 +597,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public INetHandler getClientPlayHandler()
{
return this.currentPlayClient;
return this.currentPlayClient == null ? null : this.currentPlayClient.get();
}
@Override
public NetworkManager getClientToServerNetworkManager()
@@ -811,7 +812,7 @@ public class FMLClientHandler implements IFMLSidedHandler
public void setPlayClient(NetHandlerPlayClient netHandlerPlayClient)
{
playClientBlock.countDown();
this.currentPlayClient = netHandlerPlayClient;
this.currentPlayClient = new WeakReference(netHandlerPlayClient);
}
@Override