From 16aeb84cd35996a6b41f10cbc48a677eeccc911c Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 2 Jan 2021 13:50:34 +0000 Subject: Fix potential destruction crashes (#5095) * Fix potential destruction crashes * Fix destructors accessing destroyted objects * Fix cPlayer not destroying windows (Destroyed never called) * Tentatively fixes #4608, fixes #3236, fixes #3262 - Remove cEntity::Destroyed() and replace with cEntity::OnRemoveFromWorld() * Add missing call to OnRemoveFromWorld --- src/BlockEntities/BrewingstandEntity.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/BlockEntities/BrewingstandEntity.h') diff --git a/src/BlockEntities/BrewingstandEntity.h b/src/BlockEntities/BrewingstandEntity.h index 5f6822ff7..67a6da1a3 100644 --- a/src/BlockEntities/BrewingstandEntity.h +++ b/src/BlockEntities/BrewingstandEntity.h @@ -8,6 +8,7 @@ + class cClientHandle; @@ -43,11 +44,9 @@ public: /** Constructor used for normal operation */ cBrewingstandEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World); - virtual ~cBrewingstandEntity() override; - - // cBlockEntity overrides: - virtual void Destroy() override; + // cBlockEntity overrides: virtual void CopyFrom(const cBlockEntity & a_Src) override; + virtual void OnRemoveFromWorld() override; virtual void SendTo(cClientHandle & a_Client) override; virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; virtual bool UsedBy(cPlayer * a_Player) override; @@ -110,12 +109,8 @@ public: /** Gets the recipes. Will be called if the brewing stand gets loaded from the world. */ void LoadRecipes(void); - protected: - /** Set to true when the brewing stand entity has been destroyed to prevent the block being set again */ - bool m_IsDestroyed; - /** Set to true if the brewing stand is brewing an item */ bool m_IsBrewing; -- cgit v1.2.3