diff --git a/LEGO1/lego/legoomni/include/legoroimaplist.h b/LEGO1/lego/legoomni/include/legoroimaplist.h index 697c2dd8..05a03b44 100644 --- a/LEGO1/lego/legoomni/include/legoroimaplist.h +++ b/LEGO1/lego/legoomni/include/legoroimaplist.h @@ -15,6 +15,23 @@ class LegoROI; // VTABLE: LEGO1 0x100d9248 // class MxPtrList +// Specialize MxPtrList for LegoROI* in order to fix Destroy. +// TODO: Change to using constexpr in MxPtrList::Destroy once C++17 standard works. +template <> +class MxPtrList : public MxList { +public: + MxPtrList(MxBool p_ownership) { SetOwnership(p_ownership); } + + static void Destroy(LegoROI** p_obj) { delete[] p_obj; } + + void SetOwnership(MxBool p_ownership) + { + MxCollection::SetDestroy( + p_ownership ? MxPtrList::Destroy : MxCollection::Destroy + ); + } +}; + // VTABLE: LEGO1 0x100d9260 // SIZE 0x18 class LegoROIMapList : public MxPtrList {