Skip to content

Commit

Permalink
Ensure we dispose display module textures on the render thread.
Browse files Browse the repository at this point in the history
Regression from changing disposer to run on server as well, to allow full dispose in all cases.
  • Loading branch information
fnuecke committed Jan 6, 2023
1 parent 36cbc8c commit a31f30b
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import li.cil.tis3d.client.renderer.ModRenderType;
import li.cil.tis3d.util.Color;
import li.cil.tis3d.util.EnumUtils;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

import java.util.Arrays;

Expand Down Expand Up @@ -280,12 +280,16 @@ private RenderType getOrCreateRenderLayer() {
@Environment(EnvType.CLIENT)
private void deleteTexture() {
if (textureId != null) {
Minecraft.getInstance().getTextureManager().release(textureId);
Minecraft.getInstance().doRunTask(() -> {
Minecraft.getInstance().getTextureManager().release(textureId);
});
}

if (texture != null) {
texture.close();
texture = null;
Minecraft.getInstance().doRunTask(() -> {
texture.close();
texture = null;
});
}
}

Expand Down

0 comments on commit a31f30b

Please sign in to comment.