diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-09-14 02:57:42 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-09-14 05:44:52 +0200 |
commit | 67f7a6c398b3884e4012d10ffde4480a28a73f12 (patch) | |
tree | 19537dccce569fdeed757be002f6aa8d422e410a /src/core | |
parent | Merge pull request #7002 from ameerj/vk-state-unused (diff) | |
download | yuzu-67f7a6c398b3884e4012d10ffde4480a28a73f12.tar yuzu-67f7a6c398b3884e4012d10ffde4480a28a73f12.tar.gz yuzu-67f7a6c398b3884e4012d10ffde4480a28a73f12.tar.bz2 yuzu-67f7a6c398b3884e4012d10ffde4480a28a73f12.tar.lz yuzu-67f7a6c398b3884e4012d10ffde4480a28a73f12.tar.xz yuzu-67f7a6c398b3884e4012d10ffde4480a28a73f12.tar.zst yuzu-67f7a6c398b3884e4012d10ffde4480a28a73f12.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index ba4629993..b13350f6e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -83,6 +83,12 @@ FileSys::StorageId GetStorageIdForFrontendSlot( } } +void KProcessDeleter(Kernel::KProcess* process) { + process->Destroy(); +} + +using KProcessPtr = std::unique_ptr<Kernel::KProcess, decltype(&KProcessDeleter)>; + } // Anonymous namespace FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs, @@ -233,8 +239,8 @@ struct System::Impl { } telemetry_session->AddInitialInfo(*app_loader, fs_controller, *content_provider); - auto main_process = Kernel::KProcess::Create(system.Kernel()); - ASSERT(Kernel::KProcess::Initialize(main_process, system, "main", + main_process = KProcessPtr{Kernel::KProcess::Create(system.Kernel()), KProcessDeleter}; + ASSERT(Kernel::KProcess::Initialize(main_process.get(), system, "main", Kernel::KProcess::ProcessType::Userland) .IsSuccess()); main_process->Open(); @@ -247,7 +253,7 @@ struct System::Impl { static_cast<u32>(load_result)); } AddGlueRegistrationForProcess(*app_loader, *main_process); - kernel.MakeCurrentProcess(main_process); + kernel.MakeCurrentProcess(main_process.get()); kernel.InitializeCores(); // Initialize cheat engine @@ -316,6 +322,8 @@ struct System::Impl { kernel.Shutdown(); memory.Reset(); applet_manager.ClearAll(); + // TODO: The main process should be freed based on KAutoObject ref counting. + main_process.reset(); LOG_DEBUG(Core, "Shutdown OK"); } @@ -374,6 +382,7 @@ struct System::Impl { std::unique_ptr<Tegra::GPU> gpu_core; std::unique_ptr<Hardware::InterruptManager> interrupt_manager; std::unique_ptr<Core::DeviceMemory> device_memory; + KProcessPtr main_process{nullptr, KProcessDeleter}; Core::Memory::Memory memory; CpuManager cpu_manager; std::atomic_bool is_powered_on{}; |