Commit 02b525bb authored by Dominik Charousset's avatar Dominik Charousset

Fix accessing incompletely constructed derived ptr

parent 628fdab2
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
// -- overridden functions of monitorable_actor ------------------------------ // -- overridden functions of monitorable_actor ------------------------------
bool cleanup(error&& fail_state, execution_unit* ptr) override { bool cleanup(error&& fail_state, execution_unit* ptr) override {
auto me = dptr()->ctrl(); auto me = this->ctrl();
for (auto& subscription : subscriptions_) for (auto& subscription : subscriptions_)
subscription->unsubscribe(me); subscription->unsubscribe(me);
subscriptions_.clear(); subscriptions_.clear();
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
CAF_LOG_TRACE(CAF_ARG(what)); CAF_LOG_TRACE(CAF_ARG(what));
if (what == invalid_group) if (what == invalid_group)
return; return;
if (what->subscribe(dptr()->ctrl())) if (what->subscribe(this->ctrl()))
subscriptions_.emplace(what); subscriptions_.emplace(what);
} }
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
void leave(const group& what) { void leave(const group& what) {
CAF_LOG_TRACE(CAF_ARG(what)); CAF_LOG_TRACE(CAF_ARG(what));
if (subscriptions_.erase(what) > 0) if (subscriptions_.erase(what) > 0)
what->unsubscribe(dptr()->ctrl()); what->unsubscribe(this->ctrl());
} }
/// Returns all subscribed groups. /// Returns all subscribed groups.
...@@ -86,10 +86,6 @@ public: ...@@ -86,10 +86,6 @@ public:
} }
private: private:
Subtype* dptr() {
return static_cast<Subtype*>(this);
}
// -- data members ----------------------------------------------------------- // -- data members -----------------------------------------------------------
/// Stores all subscribed groups. /// Stores all subscribed groups.
......
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