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) {
bool abstract_actor::remove_link_impl(const actor_addr& other) {
CAF_LOG_TRACE(CAF_TSARG(other));
if (!other) {
if (other == invalid_actor_addr || other == this) {
return false;
}
default_attachable::observe_token tk{other, default_attachable::link};
guard_type guard{m_mtx};
// remove_backlink returns true if this actor is linked to other
auto ptr = actor_cast<abstract_actor_ptr>(other);
if (!exited() && ptr->remove_backlink(address())) {
detach_impl(tk, m_attachables_head, true);
if (detach_impl(tk, m_attachables_head, true) > 0) {
// tell remote side to remove link as well
ptr->remove_backlink(address());
return true;
}
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