Destructor restart fixes

This commit is contained in:
Thomas Brain 2022-09-01 09:37:15 -05:00
parent 940afad3f5
commit e476f1fa9b
3 changed files with 27 additions and 8 deletions

View File

@ -97,7 +97,7 @@ BaseIntegrationGroup::swap (
BaseIntegrationGroup::~BaseIntegrationGroup ( BaseIntegrationGroup::~BaseIntegrationGroup (
void) void)
{ {
Er7UtilsDeletable::delete_instance (integ_controls); alloc::delete_object (integ_controls);
} }

View File

@ -177,7 +177,10 @@ namespace er7_utils {
template <typename T> template <typename T>
inline void delete_object (T*& obj) { inline void delete_object (T*& obj) {
if (obj) { if (obj) {
TMM_delete_var_a (type_traits::get_allocated_pointer (obj)); if (get_alloc_info_of(obj) != 0x0)
{
TMM_delete_var_a (type_traits::get_allocated_pointer (obj));
}
obj = 0; obj = 0;
} }
} }

View File

@ -72,15 +72,31 @@ Trick::IPPythonEvent::IPPythonEvent() {
Trick::IPPythonEvent::~IPPythonEvent() { Trick::IPPythonEvent::~IPPythonEvent() {
for (int ii=0; ii<condition_count; ii++) { if (TMM_is_alloced((char *)condition_list))
TMM_delete_var_a(condition_list[ii]); {
for (int ii=0; ii<condition_count; ii++) {
if (TMM_is_alloced((char *)condition_list[ii]))
{
TMM_delete_var_a(condition_list[ii]);
}
condition_list[ii] = 0x0;
}
TMM_delete_var_a(condition_list);
} }
TMM_delete_var_a(condition_list); condition_list = 0x0;
for (int ii=0; ii<action_count; ii++) { if (TMM_is_alloced((char *)action_list))
TMM_delete_var_a(action_list[ii]); {
for (int ii=0; ii<action_count; ii++) {
if (TMM_is_alloced((char *)action_list[ii]))
{
TMM_delete_var_a(action_list[ii]);
}
action_list[ii] = 0x0;
}
TMM_delete_var_a(action_list);
} }
TMM_delete_var_a(action_list); action_list = 0x0;
} }
void Trick::IPPythonEvent::set_python_processor(Trick::IPPython * in_ip) { void Trick::IPPythonEvent::set_python_processor(Trick::IPPython * in_ip) {