X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5e7d79b763a5f55d1afb579d2b5a8d30ccfe869c..79739657970ffcf609c1e90f6112e8f5a8583801:/src/surf/cpu_ti.cpp diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 6cf864c64d..c2b3eb6daf 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -625,29 +625,20 @@ CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed, CpuTi *cp { cpu_->modified(true); } - -void CpuTiAction::set_state(Action::State state) +CpuTiAction::~CpuTiAction() { - CpuAction::set_state(state); + /* remove from action_set */ + if (action_ti_hook.is_linked()) + simgrid::xbt::intrusive_erase(cpu_->actionSet_, *this); + /* remove from heap */ + heapRemove(get_model()->getActionHeap()); cpu_->modified(true); } -int CpuTiAction::unref() +void CpuTiAction::set_state(Action::State state) { - refcount_--; - if (not refcount_) { - if (state_set_hook_.is_linked()) - simgrid::xbt::intrusive_erase(*get_state_set(), *this); - /* remove from action_set */ - if (action_ti_hook.is_linked()) - simgrid::xbt::intrusive_erase(cpu_->actionSet_, *this); - /* remove from heap */ - heapRemove(get_model()->getActionHeap()); - cpu_->modified(true); - delete this; - return 1; - } - return 0; + CpuAction::set_state(state); + cpu_->modified(true); } void CpuTiAction::cancel()