mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-23 20:13:46 -04:00
Fix wrong delete
in MxPtrList<LegoROI*>
(#111)
* Use delete[] for array types in `MxPtrList::Destroy` * Use template specialization solution
This commit is contained in:
parent
77cb46f91d
commit
d5b5148cd5
@ -15,6 +15,23 @@ class LegoROI;
|
|||||||
// VTABLE: LEGO1 0x100d9248
|
// VTABLE: LEGO1 0x100d9248
|
||||||
// class MxPtrList<LegoROI *>
|
// class MxPtrList<LegoROI *>
|
||||||
|
|
||||||
|
// Specialize MxPtrList for LegoROI* in order to fix Destroy.
|
||||||
|
// TODO: Change to using constexpr in MxPtrList<T>::Destroy once C++17 standard works.
|
||||||
|
template <>
|
||||||
|
class MxPtrList<LegoROI*> : public MxList<LegoROI**> {
|
||||||
|
public:
|
||||||
|
MxPtrList(MxBool p_ownership) { SetOwnership(p_ownership); }
|
||||||
|
|
||||||
|
static void Destroy(LegoROI** p_obj) { delete[] p_obj; }
|
||||||
|
|
||||||
|
void SetOwnership(MxBool p_ownership)
|
||||||
|
{
|
||||||
|
MxCollection<LegoROI**>::SetDestroy(
|
||||||
|
p_ownership ? MxPtrList<LegoROI*>::Destroy : MxCollection<LegoROI**>::Destroy
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100d9260
|
// VTABLE: LEGO1 0x100d9260
|
||||||
// SIZE 0x18
|
// SIZE 0x18
|
||||||
class LegoROIMapList : public MxPtrList<LegoROI*> {
|
class LegoROIMapList : public MxPtrList<LegoROI*> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user