From 18c74535301d350ead79551257a2372b7b63c39c Mon Sep 17 00:00:00 2001 From: ndeadly <24677491+ndeadly@users.noreply.github.com> Date: Wed, 30 Mar 2022 16:16:08 +1100 Subject: [PATCH] mc.mitm: return shared_ptr from LocateHandler function instead of raw pointer --- mc_mitm/source/controllers/controller_management.cpp | 4 ++-- mc_mitm/source/controllers/controller_management.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mc_mitm/source/controllers/controller_management.cpp b/mc_mitm/source/controllers/controller_management.cpp index d7e7751..dfea110 100644 --- a/mc_mitm/source/controllers/controller_management.cpp +++ b/mc_mitm/source/controllers/controller_management.cpp @@ -299,12 +299,12 @@ namespace ams::controller { } } - SwitchController *LocateHandler(const bluetooth::Address *address) { + std::shared_ptr LocateHandler(const bluetooth::Address *address) { std::scoped_lock lk(g_controller_lock); for (auto it = g_controllers.begin(); it < g_controllers.end(); ++it) { if (bdcmp(&(*it)->Address(), address)) { - return (*it).get(); + return (*it); } } diff --git a/mc_mitm/source/controllers/controller_management.hpp b/mc_mitm/source/controllers/controller_management.hpp index 79bd947..29b7fac 100644 --- a/mc_mitm/source/controllers/controller_management.hpp +++ b/mc_mitm/source/controllers/controller_management.hpp @@ -85,6 +85,6 @@ namespace ams::controller { void AttachHandler(const bluetooth::Address *address); void RemoveHandler(const bluetooth::Address *address); - SwitchController *LocateHandler(const bluetooth::Address *address); + std::shared_ptr LocateHandler(const bluetooth::Address *address); }