From 659a612368c98002037d904d511473d8da8e69e4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 20 Apr 2018 19:29:04 -0400 Subject: core: Relocate g_service_manager to the System class Converts the service manager from a global into an instance-based variable. --- src/core/hle/service/sm/sm.cpp | 4 +++- src/core/hle/service/sm/sm.h | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/core/hle/service/sm') diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 297a4f2c6..4578fc05f 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -14,6 +14,8 @@ namespace Service::SM { +ServiceManager::~ServiceManager() = default; + void ServiceManager::InvokeControlRequest(Kernel::HLERequestContext& context) { controller_interface->InvokeRequest(context); } @@ -72,7 +74,7 @@ ResultVal> ServiceManager::ConnectToSer return client_port->Connect(); } -std::shared_ptr g_service_manager; +SM::~SM() = default; /** * SM::Initialize service function diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index 40421cfd5..13f5c4c28 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -23,7 +23,7 @@ namespace Service::SM { class SM final : public ServiceFramework { public: SM(std::shared_ptr service_manager); - ~SM() = default; + ~SM() override; private: void Initialize(Kernel::HLERequestContext& ctx); @@ -44,6 +44,8 @@ class ServiceManager { public: static void InstallInterfaces(std::shared_ptr self); + ~ServiceManager(); + ResultVal> RegisterService(std::string name, unsigned int max_sessions); ResultVal> GetServicePort(const std::string& name); @@ -59,6 +61,4 @@ private: std::unordered_map> registered_services; }; -extern std::shared_ptr g_service_manager; - } // namespace Service::SM -- cgit v1.2.3