summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-24 02:00:46 +0200
committerbunnei <bunneidev@gmail.com>2021-05-06 01:40:52 +0200
commit39a8dba9a67385b2e246dbf96b22adcb8fc53c03 (patch)
tree7c82d079b06324206a59cb4fca16ba78b7fdf8fc /src/core/hle
parenthle: kernel: Migrate KPort, KClientPort, and KServerPort to KAutoObject. (diff)
downloadyuzu-39a8dba9a67385b2e246dbf96b22adcb8fc53c03.tar
yuzu-39a8dba9a67385b2e246dbf96b22adcb8fc53c03.tar.gz
yuzu-39a8dba9a67385b2e246dbf96b22adcb8fc53c03.tar.bz2
yuzu-39a8dba9a67385b2e246dbf96b22adcb8fc53c03.tar.lz
yuzu-39a8dba9a67385b2e246dbf96b22adcb8fc53c03.tar.xz
yuzu-39a8dba9a67385b2e246dbf96b22adcb8fc53c03.tar.zst
yuzu-39a8dba9a67385b2e246dbf96b22adcb8fc53c03.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/kernel.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index c939bb903..b2eb51bde 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -129,20 +129,18 @@ struct KernelCore::Impl {
exclusive_monitor.reset();
- hid_shared_mem->Close();
- hid_shared_mem = nullptr;
-
- font_shared_mem->Close();
- font_shared_mem = nullptr;
-
- irs_shared_mem->Close();
- irs_shared_mem = nullptr;
-
- time_shared_mem->Close();
- time_shared_mem = nullptr;
-
- system_resource_limit->Close();
- system_resource_limit = nullptr;
+ // Cleanup persistent kernel objects
+ auto CleanupObject = [](KAutoObject* obj) {
+ if (obj) {
+ obj->Close();
+ obj = nullptr;
+ }
+ };
+ CleanupObject(hid_shared_mem);
+ CleanupObject(font_shared_mem);
+ CleanupObject(irs_shared_mem);
+ CleanupObject(time_shared_mem);
+ CleanupObject(system_resource_limit);
// Next host thead ID to use, 0-3 IDs represent core threads, >3 represent others
next_host_thread_id = Core::Hardware::NUM_CPU_CORES;