Commit 44bf62ad authored by Dominik Charousset's avatar Dominik Charousset

Fix heap-use-after-free in brokers, close #344

parent 698e7134
......@@ -43,7 +43,9 @@ public:
protected:
void detach_from_parent() override {
this->parent()->erase(hdl_);
auto ptr = this->parent();
this->set_parent(nullptr);
ptr->erase(hdl_);
}
void invoke_mailbox_element() {
......
......@@ -44,13 +44,12 @@ void manager::detach(bool invoke_disconnect_message) {
CAF_LOG_TRACE("");
if (! detached()) {
CAF_LOG_DEBUG("disconnect servant from broker");
detach_from_parent();
if (invoke_disconnect_message) {
auto ptr = mailbox_element::make(invalid_actor_addr, invalid_message_id,
detach_message());
parent_->exec_single_event(ptr);
}
parent_ = nullptr;
detach_from_parent();
}
}
......
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