From: Arnaud Giersch Date: Tue, 26 Sep 2017 13:16:53 +0000 (+0200) Subject: Delete timer on removal. X-Git-Tag: v3_17~73 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/47e39aa9787af784b651e6be2ed219d0d40234fb?hp=bce15ff3e6e8662b2586202122bbd2698a57abe2 Delete timer on removal. --- 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) */