diff --git a/include/mbgl/actor/actor_ref.hpp b/include/mbgl/actor/actor_ref.hpp index 9d858d823..aeb5bb450 100644 --- a/include/mbgl/actor/actor_ref.hpp +++ b/include/mbgl/actor/actor_ref.hpp @@ -24,19 +24,19 @@ template class ActorRef { public: ActorRef(Object& object_, std::weak_ptr weakMailbox_) - : object(object_), + : object(&object_), weakMailbox(std::move(weakMailbox_)) { } template void invoke(Fn fn, Args&&... args) { if (auto mailbox = weakMailbox.lock()) { - mailbox->push(actor::makeMessage(object, fn, std::forward(args)...)); + mailbox->push(actor::makeMessage(*object, fn, std::forward(args)...)); } } private: - Object& object; + Object* object; std::weak_ptr weakMailbox; };