diff options
| author | 2020-11-24 14:31:58 -0800 | |
|---|---|---|
| committer | 2020-11-24 14:31:58 -0800 | |
| commit | 7791cc8c2e585dcc377e22a26f548db914250a5d (patch) | |
| tree | 81273d60fee9da0146317881711b6f0b43650355 /src/core/hle/service/service.cpp | |
| parent | Merge pull request #3681 from lioncash/component (diff) | |
| download | yuzu-7791cc8c2e585dcc377e22a26f548db914250a5d.tar.gz yuzu-7791cc8c2e585dcc377e22a26f548db914250a5d.tar.xz yuzu-7791cc8c2e585dcc377e22a26f548db914250a5d.zip | |
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.
Diffstat (limited to 'src/core/hle/service/service.cpp')
| -rw-r--r-- | src/core/hle/service/service.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index fbfda2d5b..fb4979af2 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -188,17 +188,19 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co | |||
| 188 | return RESULT_SUCCESS; | 188 | return RESULT_SUCCESS; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | /// Initialize ServiceManager | 191 | /// Initialize Services |
| 192 | void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system) { | 192 | Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system) |
| 193 | : nv_flinger{std::make_unique<NVFlinger::NVFlinger>(system)} { | ||
| 194 | |||
| 193 | // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it | 195 | // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it |
| 194 | // here and pass it into the respective InstallInterfaces functions. | 196 | // here and pass it into the respective InstallInterfaces functions. |
| 195 | auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>(system); | 197 | |
| 196 | system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false); | 198 | system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false); |
| 197 | 199 | ||
| 198 | SM::ServiceManager::InstallInterfaces(sm, system.Kernel()); | 200 | SM::ServiceManager::InstallInterfaces(sm, system.Kernel()); |
| 199 | 201 | ||
| 200 | Account::InstallInterfaces(system); | 202 | Account::InstallInterfaces(system); |
| 201 | AM::InstallInterfaces(*sm, nv_flinger, system); | 203 | AM::InstallInterfaces(*sm, *nv_flinger, system); |
| 202 | AOC::InstallInterfaces(*sm, system); | 204 | AOC::InstallInterfaces(*sm, system); |
| 203 | APM::InstallInterfaces(system); | 205 | APM::InstallInterfaces(system); |
| 204 | Audio::InstallInterfaces(*sm, system); | 206 | Audio::InstallInterfaces(*sm, system); |
| @@ -246,14 +248,10 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system) { | |||
| 246 | SSL::InstallInterfaces(*sm); | 248 | SSL::InstallInterfaces(*sm); |
| 247 | Time::InstallInterfaces(system); | 249 | Time::InstallInterfaces(system); |
| 248 | USB::InstallInterfaces(*sm); | 250 | USB::InstallInterfaces(*sm); |
| 249 | VI::InstallInterfaces(*sm, nv_flinger); | 251 | VI::InstallInterfaces(*sm, *nv_flinger); |
| 250 | WLAN::InstallInterfaces(*sm); | 252 | WLAN::InstallInterfaces(*sm); |
| 251 | |||
| 252 | LOG_DEBUG(Service, "initialized OK"); | ||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | /// Shutdown ServiceManager | 255 | Services::~Services() = default; |
| 256 | void Shutdown() { | 256 | |
| 257 | LOG_DEBUG(Service, "shutdown OK"); | ||
| 258 | } | ||
| 259 | } // namespace Service | 257 | } // namespace Service |