From 7791cc8c2e585dcc377e22a26f548db914250a5d Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 24 Nov 2020 14:31:58 -0800 Subject: hle: services: Fix a crash with improper NVFlinger lifetime management. (#4977) * hle: services: Fix a crash with improper NVFlinger lifetime management. - This crash would happen when attempting to shutdown yuzu early on in boot. --- src/core/hle/service/service.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/core/hle/service/service.h') diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index a01ef3353..ed4792289 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -29,7 +29,11 @@ namespace Service { namespace FileSystem { class FileSystemController; -} // namespace FileSystem +} + +namespace NVFlinger { +class NVFlinger; +} namespace SM { class ServiceManager; @@ -181,10 +185,17 @@ private: } }; -/// Initialize ServiceManager -void Init(std::shared_ptr& sm, Core::System& system); +/** + * The purpose of this class is to own any objects that need to be shared across the other service + * implementations. Will be torn down when the global system instance is shutdown. + */ +class Services final { +public: + explicit Services(std::shared_ptr& sm, Core::System& system); + ~Services(); -/// Shutdown ServiceManager -void Shutdown(); +private: + std::unique_ptr nv_flinger; +}; } // namespace Service -- cgit v1.2.3