Commit ff39a62e authored by Dominik Charousset's avatar Dominik Charousset

Fix unlink if other actor has already terminated

parent 4248352a
...@@ -168,15 +168,16 @@ bool abstract_actor::establish_backlink_impl(const actor_addr& other) { ...@@ -168,15 +168,16 @@ bool abstract_actor::establish_backlink_impl(const actor_addr& other) {
bool abstract_actor::remove_link_impl(const actor_addr& other) { bool abstract_actor::remove_link_impl(const actor_addr& other) {
CAF_LOG_TRACE(CAF_TSARG(other)); CAF_LOG_TRACE(CAF_TSARG(other));
if (!other) { if (other == invalid_actor_addr || other == this) {
return false; return false;
} }
default_attachable::observe_token tk{other, default_attachable::link}; default_attachable::observe_token tk{other, default_attachable::link};
guard_type guard{m_mtx}; guard_type guard{m_mtx};
// remove_backlink returns true if this actor is linked to other // remove_backlink returns true if this actor is linked to other
auto ptr = actor_cast<abstract_actor_ptr>(other); auto ptr = actor_cast<abstract_actor_ptr>(other);
if (!exited() && ptr->remove_backlink(address())) { if (detach_impl(tk, m_attachables_head, true) > 0) {
detach_impl(tk, m_attachables_head, true); // tell remote side to remove link as well
ptr->remove_backlink(address());
return true; return true;
} }
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment