From 47e39aa9787af784b651e6be2ed219d0d40234fb Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 26 Sep 2017 15:16:53 +0200 Subject: [PATCH 1/1] Delete timer on removal. --- src/simix/ActorImpl.cpp | 4 +++- src/simix/smx_global.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 124aae8571..a55a783f3b 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -73,8 +73,10 @@ void SIMIX_process_cleanup(smx_actor_t process) SIMIX_process_on_exit_runall(process); /* Unregister from the kill timer if any */ - if (process->kill_timer != nullptr) + if (process->kill_timer != nullptr) { SIMIX_timer_remove(process->kill_timer); + process->kill_timer = nullptr; + } xbt_os_mutex_acquire(simix_global->mutex); diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index dd8daa8d6f..90deaa8ede 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -575,7 +575,7 @@ smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task callback) /** @brief cancels a timer that was added earlier */ void SIMIX_timer_remove(smx_timer_t timer) { - xbt_heap_rm_elm(simix_timers, timer, timer->getDate()); + delete static_cast(xbt_heap_rm_elm(simix_timers, timer, timer->getDate())); } /** @brief Returns the date at which the timer will trigger (or 0 if nullptr timer) */ -- 2.20.1