From 9a32b79ea1d817464110a3c2b995091797e2c70e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 26 Dec 2024 12:47:16 -0700 Subject: [PATCH] Match `MxPtrList::Destroy` --- LEGO1/lego/legoomni/include/legonamedpart.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/LEGO1/lego/legoomni/include/legonamedpart.h b/LEGO1/lego/legoomni/include/legonamedpart.h index dcdee2f9f0..a03da68c0f 100644 --- a/LEGO1/lego/legoomni/include/legonamedpart.h +++ b/LEGO1/lego/legoomni/include/legonamedpart.h @@ -12,7 +12,18 @@ class LegoNamedPart { m_name = p_name; m_list = p_list; } - ~LegoNamedPart() { delete m_list; } + ~LegoNamedPart() + { + LegoLODListCursor cursor(m_list); + LegoLOD* lod; + + while (cursor.First(lod)) { + cursor.Detach(); + delete lod; + } + + delete m_list; + } const MxString* GetName() const { return &m_name; } LegoLODList* GetList() { return m_list; }