From e476f1fa9b5484cb201392249accb49bdf109d7a Mon Sep 17 00:00:00 2001 From: Thomas Brain Date: Thu, 1 Sep 2022 09:37:15 -0500 Subject: [PATCH] Destructor restart fixes --- .../core/src/base_integration_group.cc | 2 +- .../er7_utils/interface/include/alloc.hh | 5 +++- .../InputProcessor/IPPythonEvent.cpp | 28 +++++++++++++++---- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/trick_source/er7_utils/integration/core/src/base_integration_group.cc b/trick_source/er7_utils/integration/core/src/base_integration_group.cc index cf6b27fc..c3be8aff 100644 --- a/trick_source/er7_utils/integration/core/src/base_integration_group.cc +++ b/trick_source/er7_utils/integration/core/src/base_integration_group.cc @@ -97,7 +97,7 @@ BaseIntegrationGroup::swap ( BaseIntegrationGroup::~BaseIntegrationGroup ( void) { - Er7UtilsDeletable::delete_instance (integ_controls); + alloc::delete_object (integ_controls); } diff --git a/trick_source/er7_utils/interface/include/alloc.hh b/trick_source/er7_utils/interface/include/alloc.hh index 0bfa174e..2d26d06f 100644 --- a/trick_source/er7_utils/interface/include/alloc.hh +++ b/trick_source/er7_utils/interface/include/alloc.hh @@ -177,7 +177,10 @@ namespace er7_utils { template inline void delete_object (T*& 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; } } diff --git a/trick_source/sim_services/InputProcessor/IPPythonEvent.cpp b/trick_source/sim_services/InputProcessor/IPPythonEvent.cpp index 6ea4e25c..3db54c32 100644 --- a/trick_source/sim_services/InputProcessor/IPPythonEvent.cpp +++ b/trick_source/sim_services/InputProcessor/IPPythonEvent.cpp @@ -72,15 +72,31 @@ Trick::IPPythonEvent::IPPythonEvent() { Trick::IPPythonEvent::~IPPythonEvent() { - for (int ii=0; ii