Prevented extra memory leaks

This commit is contained in:
Anuken 2020-01-17 21:33:14 -05:00
parent 569b1f788f
commit 121301c7bd
2 changed files with 5 additions and 4 deletions

View File

@ -42,7 +42,7 @@ public class Mods implements Loadable{
private Array<LoadedMod> mods = new Array<>();
private ObjectMap<Class<?>, ModMeta> metas = new ObjectMap<>();
private boolean requiresReload;
private boolean requiresReload, createdAtlas;
public Mods(){
Events.on(ClientLoadEvent.class, e -> Core.app.post(this::checkWarnings));
@ -152,7 +152,8 @@ public class Mods implements Loadable{
//get textures packed
if(totalSprites > 0){
Core.atlas = new TextureAtlas(Core.files.internal("sprites/sprites.atlas"));
if(!createdAtlas) Core.atlas = new TextureAtlas(Core.files.internal("sprites/sprites.atlas"));
createdAtlas = true;
for(AtlasRegion region : Core.atlas.getRegions()){
PageType type = getPage(region);
@ -176,7 +177,6 @@ public class Mods implements Loadable{
});
}
//TODO !!!! fix the UI page here
Core.atlas = packer.flush(filter, new TextureAtlas());
Core.atlas.setErrorRegion("error");
Log.debug("Total pages: {0}", Core.atlas.getTextures().size);
@ -422,6 +422,7 @@ public class Mods implements Loadable{
//epic memory leak
//TODO make it less epic
Core.atlas = new TextureAtlas(Core.files.internal("sprites/sprites.atlas"));
createdAtlas = true;
mods.each(LoadedMod::dispose);
mods.clear();

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=2f9e4392cd2a2db1d0af4f191d2799ac0b71ed10
archash=ff62d39e0fa294117a885010b05b2b29412b4024