From 9248910baf5bab301c7329182b143870321a95f0 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 22 Oct 2022 19:02:57 +0300 Subject: [PATCH] Fix some pointer/reference mismatches in EventBus --- source/game/eventbus.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/game/eventbus.h b/source/game/eventbus.h index ce9c812..e096635 100644 --- a/source/game/eventbus.h +++ b/source/game/eventbus.h @@ -57,7 +57,7 @@ private: public: template void add_observer(EventObserver &obs, std::function cb) - { get_emitter().add_observer(obs, std::move(cb)); } + { get_emitter().add_observer(&obs, std::move(cb)); } void replace_observer(EventObserver &, EventObserver &); void remove_observer(EventObserver &); @@ -94,10 +94,10 @@ inline EventDispatcher &EventBus::get_emitter() { event.dispatcher = new EventDispatcher; event.deleter = [](void *p){ delete static_cast *>(p); }; - event.remover = [](void *p, EventObserver &o){ static_cast *>(p)->remove_observer(o); }; + event.remover = [](void *p, EventObserver &o){ static_cast *>(p)->remove_observer(&o); }; } - return static_cast *>(event.dispatcher); + return *static_cast *>(event.dispatcher); } template -- 2.45.2