diff --git a/lib/src/dexode/eventbus/perk/PerkEventBus.cpp b/lib/src/dexode/eventbus/perk/PerkEventBus.cpp index afe605d..46d33db 100644 --- a/lib/src/dexode/eventbus/perk/PerkEventBus.cpp +++ b/lib/src/dexode/eventbus/perk/PerkEventBus.cpp @@ -6,7 +6,7 @@ namespace dexode::eventbus::perk { -PerkEventBus::RegisterHelper PerkEventBus::addPerk(std::unique_ptr perk) +PerkEventBus::RegisterHelper PerkEventBus::addPerk(std::shared_ptr perk) { auto* local = perk.get(); _perks.push_back(std::move(perk)); diff --git a/lib/src/dexode/eventbus/perk/PerkEventBus.hpp b/lib/src/dexode/eventbus/perk/PerkEventBus.hpp index f3f4499..12e7603 100644 --- a/lib/src/dexode/eventbus/perk/PerkEventBus.hpp +++ b/lib/src/dexode/eventbus/perk/PerkEventBus.hpp @@ -46,13 +46,13 @@ public: {} }; - RegisterHelper addPerk(std::unique_ptr perk); + RegisterHelper addPerk(std::shared_ptr perk); template T* getPerk() { auto found = - std::find_if(_perks.begin(), _perks.end(), [](const std::unique_ptr& perk) { + std::find_if(_perks.begin(), _perks.end(), [](const std::shared_ptr& perk) { return dynamic_cast(perk.get()) != nullptr; }); if(found != _perks.end()) @@ -66,7 +66,7 @@ protected: bool postponeEvent(PostponeHelper& postponeCall) override; private: - std::vector> _perks; + std::vector> _perks; std::vector> _onPrePostpone; std::vector> _onPostPostpone; };