From: Martin Quinson Date: Fri, 2 Aug 2019 16:55:49 +0000 (+0200) Subject: run Actor::on_destruction even if the actor was killed before starting, but not on... X-Git-Tag: v3.24~213 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/df93dfaab8d79f5e08088aedc95dd2712cef4c70 run Actor::on_destruction even if the actor was killed before starting, but not on maestro It seems that the actors are sometimes killed after the simix_global destruction... Maybe when the user code keeps a reference on them. --- diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index 992ab56b37..0db52ef1a3 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -61,10 +61,12 @@ ActorImpl::ActorImpl(const simgrid::xbt::string& name, s4u::Host* host) : host_( ActorImpl::~ActorImpl() { - if (this != simix_global->maestro_process) { - context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops + if (simix_global != nullptr && this != simix_global->maestro_process) { + if (context_.get() != nullptr) /* the actor was not start()ed yet. This happens if its host was initially off */ + context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops simgrid::simix::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); }); - context_->iwannadie = true; + if (context_.get() != nullptr) + context_->iwannadie = true; } }