mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-15 09:48:31 +00:00
Fix multiple memory leaks and stale pooled allocations (#1)
This commit is contained in:
@@ -96,7 +96,8 @@ void CreateWorldScreen::buttonClicked(Button *button)
|
||||
if (done) return;
|
||||
done = true;
|
||||
|
||||
int64_t seedValue = (new Random())->nextLong();
|
||||
Random tempRandom;
|
||||
int64_t seedValue = tempRandom.nextLong();
|
||||
wstring seedString = seedEdit->getValue();
|
||||
|
||||
if (seedString.length() != 0)
|
||||
|
||||
@@ -195,6 +195,7 @@ GameRenderer::~GameRenderer()
|
||||
{
|
||||
if(rainXa != nullptr) delete [] rainXa;
|
||||
if(rainZa != nullptr) delete [] rainZa;
|
||||
delete random;
|
||||
}
|
||||
|
||||
void GameRenderer::tick(bool first) // 4J - add bFirst
|
||||
|
||||
@@ -9,11 +9,11 @@ GuiParticles::GuiParticles(Minecraft *mc)
|
||||
|
||||
GuiParticles::~GuiParticles()
|
||||
{
|
||||
for (GuiParticle *gp : particles)
|
||||
{
|
||||
delete gp;
|
||||
}
|
||||
particles.clear();
|
||||
for (GuiParticle *gp : particles)
|
||||
{
|
||||
delete gp;
|
||||
}
|
||||
particles.clear();
|
||||
}
|
||||
|
||||
void GuiParticles::tick()
|
||||
|
||||
@@ -20,7 +20,8 @@ void LightningBoltRenderer::render(shared_ptr<Entity> _bolt, double x, double y,
|
||||
double xOff = 0;
|
||||
double zOff = 0;
|
||||
{
|
||||
Random *random = new Random(bolt->seed);
|
||||
Random randomObj(bolt->seed);
|
||||
Random *random = &randomObj;
|
||||
for (int h = 7; h >= 0; h--)
|
||||
{
|
||||
xOffs[h] = xOff;
|
||||
@@ -32,7 +33,8 @@ void LightningBoltRenderer::render(shared_ptr<Entity> _bolt, double x, double y,
|
||||
|
||||
for (int r = 0; r < 4; r++)
|
||||
{
|
||||
Random *random = new Random(bolt->seed);
|
||||
Random randomObj(bolt->seed);
|
||||
Random *random = &randomObj;
|
||||
for (int p = 0; p < 3; p++)
|
||||
{
|
||||
int hs = 7;
|
||||
|
||||
Reference in New Issue
Block a user