aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-11-19 21:19:20 +0900
committersyeyoung <cyoung06@naver.com>2022-11-19 21:19:20 +0900
commit9475a966ca732deb58b2d141bfc65390419dcaa9 (patch)
treec2d18daff44fcb39d56408120bc20f480b56f529 /mod
parent6701cc47ca7280ac18a7289a2dd314b1cc4852a8 (diff)
downloadSkyblock-Dungeons-Guide-9475a966ca732deb58b2d141bfc65390419dcaa9.tar.gz
Skyblock-Dungeons-Guide-9475a966ca732deb58b2d141bfc65390419dcaa9.tar.bz2
Skyblock-Dungeons-Guide-9475a966ca732deb58b2d141bfc65390419dcaa9.zip
- Prevent Reference Leak via ProtectionDomain
- Prevent Reference Leak via ThreadDownloadImageData (set imagebuffer to null) Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod')
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java13
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/GameSDK.java1
2 files changed, 13 insertions, 1 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
index f3c600fc..5ef83afa 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
@@ -51,7 +51,10 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.*;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.network.NetworkPlayerInfo;
+import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.texture.ITextureObject;
+import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.command.CommandHandler;
@@ -60,6 +63,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraft.network.play.server.S38PacketPlayerListItem;
+import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.event.GuiOpenEvent;
@@ -333,6 +337,15 @@ public class DungeonsGuide implements DGInterface {
}
}
+ Map<ResourceLocation, ITextureObject> mapTextureObjects = ReflectionHelper.getPrivateValue(TextureManager.class, Minecraft.getMinecraft().getTextureManager(), "mapTextureObjects", "field_110585_a", "b");
+ for (ITextureObject value : mapTextureObjects.values()) {
+ if (value instanceof ThreadDownloadImageData) {
+ ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class,(ThreadDownloadImageData) value, null, "imageBuffer", "field_110563_c", "k");
+ }
+ }
+
+
+
World world = Minecraft.getMinecraft().getRenderManager().worldObj;
if (world != null) {
for (AbstractClientPlayer entity : world.getEntities(AbstractClientPlayer.class, input -> true)) {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/GameSDK.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/GameSDK.java
index cde3f7e2..c6fecb33 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/GameSDK.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/GameSDK.java
@@ -76,7 +76,6 @@ public class GameSDK {
public static void cleanup() {
// com.sun.jna.CallbackReference has reference of DiscordCallback. idk how i should approach fixing this -> I would better write native lib myself later.
if (System.getProperty("dg.safe") == null) return;
-
Map infos = ReflectionHelper.getPrivateValue(Structure.class, null, "layoutInfo");
infos.clear();
Map options = ReflectionHelper.getPrivateValue(Native.class, null, "options");