From 48a649abf19378bcb3533d23ac74ccd4a8ae8c94 Mon Sep 17 00:00:00 2001 From: Soggy_Pancake <54160598+Soggy-Pancake@users.noreply.github.com> Date: Tue, 3 Mar 2026 23:51:36 -0700 Subject: [PATCH] Fix exceptions when exiting after opening world. --- Minecraft.Client/Chunk.cpp | 8 ++++---- Minecraft.Client/Chunk.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/Chunk.cpp b/Minecraft.Client/Chunk.cpp index d039227bf..4da8b2e3f 100644 --- a/Minecraft.Client/Chunk.cpp +++ b/Minecraft.Client/Chunk.cpp @@ -103,7 +103,7 @@ void Chunk::setPos(int x, int y, int z) // 4J - changed to just set the value rather than make a new one, if we've already created storage if( bb == NULL ) { - bb = AABB::newPermanent(-g, -g, -g, XZSIZE+g, SIZE+g, XZSIZE+g); + bb = std::unique_ptr(AABB::newPermanent(-g, -g, -g, XZSIZE+g, SIZE+g, XZSIZE+g)); } else { @@ -171,7 +171,7 @@ void Chunk::makeCopyForRebuild(Chunk *source) this->xm = source->xm; this->ym = source->ym; this->zm = source->zm; - this->bb = source->bb; + this->bb = move(source->bb); this->clipChunk = NULL; this->id = source->id; this->globalRenderableTileEntities = source->globalRenderableTileEntities; @@ -998,7 +998,7 @@ int Chunk::getList(int layer) void Chunk::cull(Culler *culler) { - clipChunk->visible = culler->isVisible(bb); + clipChunk->visible = culler->isVisible(bb.get()); } void Chunk::renderBB() @@ -1029,7 +1029,7 @@ void Chunk::clearDirty() Chunk::~Chunk() { - delete bb; + // delete bb; } bool Chunk::emptyFlagSet(int layer) diff --git a/Minecraft.Client/Chunk.h b/Minecraft.Client/Chunk.h index f7947156f..543e79971 100644 --- a/Minecraft.Client/Chunk.h +++ b/Minecraft.Client/Chunk.h @@ -47,7 +47,7 @@ public: int xRenderOffs, yRenderOffs, zRenderOffs; int xm, ym, zm; - AABB *bb; + unique_ptr bb; ClipChunk *clipChunk; int id;