mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-05-30 14:44:41 +00:00
Fix multiple memory leaks and stale pooled allocations
* Fix Vec3/AABB pool reset logic
* resetPool()/clearPool() now reset poolPointer to 0
* Prevents endless pool growth, invalid temporary references,
and increasing memory usage
* Resolves the leaderboard-related crash mentioned in
Windows64_Minecraft.cpp
* Properly free old screens in Minecraft::setScreen()
* Added virtual destructor to Screen
* Screen destructor now cleans up GuiParticles and Buttons
* Previous screen is now deleted after screen transitions
* Screen::init() now clears old buttons/particles before re-init
* Fix GuiParticles memory leak
* Removed GuiParticle instances are now deleted in tick()
* Added GuiParticles destructor to free remaining particles
This commit is contained in:
@@ -8,6 +8,15 @@ GuiParticles::GuiParticles(Minecraft *mc)
|
||||
this->mc = mc;
|
||||
}
|
||||
|
||||
GuiParticles::~GuiParticles()
|
||||
{
|
||||
for (GuiParticle *gp : particles)
|
||||
{
|
||||
delete gp;
|
||||
}
|
||||
particles.clear();
|
||||
}
|
||||
|
||||
void GuiParticles::tick()
|
||||
{
|
||||
for (unsigned int i = 0; i < particles.size(); i++)
|
||||
@@ -19,6 +28,7 @@ void GuiParticles::tick()
|
||||
|
||||
if (gp->removed)
|
||||
{
|
||||
delete gp;
|
||||
particles.erase(particles.begin()+i);
|
||||
i--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user