diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 5268792f2..4207fe362 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -4111,7 +4111,7 @@ void CMinecraftApp::loadStringTable() { byteArray locFile = m_mediaArchive->getFile(localisationFile); m_stringTable = new StringTable(locFile.data, locFile.length); - delete locFile.data; + delete[] locFile.data; } else { diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp index 86eb37577..77e0a6ba9 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp @@ -60,11 +60,19 @@ void StitchedTexture::freeFrameTextures() StitchedTexture::~StitchedTexture() { - for(AUTO_VAR(it, frames->begin()); it != frames->end(); ++it) - { - delete *it; + // 4jcraft added null check, in PreStitchedTextures::stitch(), than ::loadUVs() + // all new SimpleIcons deriving from StitchedIcons are calling the + // constructor which does frames = NULL + // so the program breaks on delete oldClock in ::loadUVs() + // but scince "frames" is never allocated (StitchedTexture::init()) + // not called, frames was never called (only the constructor) + if(frames) { + for(AUTO_VAR(it, frames->begin()); it != frames->end(); ++it) + { + delete *it; + } + delete frames; } - delete frames; } void StitchedTexture::initUVs(float U0, float V0, float U1, float V1) @@ -351,4 +359,4 @@ int StitchedTexture::getFlags() const bool StitchedTexture::hasOwnData() { return true; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.h b/Minecraft.Client/Textures/Stitching/StitchedTexture.h index edb3c3c05..306ffd1b7 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.h +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.h @@ -86,4 +86,4 @@ public: void setFlags(int flags); // 4J added virtual void freeFrameTextures(); // 4J added virtual bool hasOwnData(); // 4J Added -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Textures/TextureManager.cpp b/Minecraft.Client/Textures/TextureManager.cpp index 6fd3813fa..546bdc17f 100644 --- a/Minecraft.Client/Textures/TextureManager.cpp +++ b/Minecraft.Client/Textures/TextureManager.cpp @@ -193,4 +193,4 @@ Texture *TextureManager::createTexture(const std::wstring &name, int mode, int w // 4J Stu - Don't clamp as it causes issues with how we signal non-mipmmapped textures to the pixel shader //return createTexture(name, mode, width, height, Texture::WM_CLAMP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL); return createTexture(name, mode, width, height, Texture::WM_WRAP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Utils/MemoryTracker.h b/Minecraft.Client/Utils/MemoryTracker.h index 8bf103be5..8492aae28 100644 --- a/Minecraft.Client/Utils/MemoryTracker.h +++ b/Minecraft.Client/Utils/MemoryTracker.h @@ -1,5 +1,4 @@ #pragma once -#include "MemoryTracker.h" class ByteBuffer; class IntBuffer; class FloatBuffer; diff --git a/Minecraft.World/Util/Icon.h b/Minecraft.World/Util/Icon.h index fa606ff48..c77fba2c9 100644 --- a/Minecraft.World/Util/Icon.h +++ b/Minecraft.World/Util/Icon.h @@ -16,6 +16,8 @@ public: static const int IS_ALPHA_CUT_OUT = 4; #endif + virtual ~Icon() {} // added by 4jcraft, needed for abstract class + virtual int getX() const = 0; virtual int getY() const = 0; virtual int getWidth() const = 0; diff --git a/debug.sh b/debug.sh new file mode 100755 index 000000000..63f1c0541 --- /dev/null +++ b/debug.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +meson compile -C build && \ +cd build/Minecraft.Client/ && \ +gdb -tui ./Minecraft.Client && \ +cd ../.. diff --git a/run.sh b/run.sh new file mode 100755 index 000000000..f4ac7e7f3 --- /dev/null +++ b/run.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +meson compile -C build && \ +cd build/Minecraft.Client/ && \ +./Minecraft.Client && \ +cd ../..