summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorFeng Chen <vonchenplus@gmail.com>2021-10-26 06:43:27 +0200
committerFeng Chen <vonchenplus@gmail.com>2021-10-27 03:06:30 +0200
commit052017e189a2558dba1dd47147ab9274f218b7fc (patch)
tree0ae2a46af72d4b8b4244d8710f0202303c50bdad /src/core
parentFix memory leak (diff)
downloadyuzu-052017e189a2558dba1dd47147ab9274f218b7fc.tar
yuzu-052017e189a2558dba1dd47147ab9274f218b7fc.tar.gz
yuzu-052017e189a2558dba1dd47147ab9274f218b7fc.tar.bz2
yuzu-052017e189a2558dba1dd47147ab9274f218b7fc.tar.lz
yuzu-052017e189a2558dba1dd47147ab9274f218b7fc.tar.xz
yuzu-052017e189a2558dba1dd47147ab9274f218b7fc.tar.zst
yuzu-052017e189a2558dba1dd47147ab9274f218b7fc.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.cpp16
-rw-r--r--src/core/hle/kernel/kernel.cpp4
2 files changed, 5 insertions, 15 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 3c75f42ae..c3a0f9dae 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -83,12 +83,6 @@ 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,
@@ -261,11 +255,10 @@ struct System::Impl {
}
telemetry_session->AddInitialInfo(*app_loader, fs_controller, *content_provider);
- main_process = KProcessPtr{Kernel::KProcess::Create(system.Kernel()), KProcessDeleter};
- ASSERT(Kernel::KProcess::Initialize(main_process.get(), system, "main",
+ auto main_process = Kernel::KProcess::Create(system.Kernel());
+ ASSERT(Kernel::KProcess::Initialize(main_process, system, "main",
Kernel::KProcess::ProcessType::Userland)
.IsSuccess());
- main_process->Open();
const auto [load_result, load_parameters] = app_loader->Load(*main_process, system);
if (load_result != Loader::ResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result);
@@ -275,7 +268,7 @@ struct System::Impl {
static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
}
AddGlueRegistrationForProcess(*app_loader, *main_process);
- kernel.MakeCurrentProcess(main_process.get());
+ kernel.MakeCurrentProcess(main_process);
kernel.InitializeCores();
// Initialize cheat engine
@@ -340,8 +333,6 @@ 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");
}
@@ -403,7 +394,6 @@ 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{};
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index d054a7925..db9f55864 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -174,8 +174,8 @@ struct KernelCore::Impl {
{
std::lock_guard lk(registered_in_use_objects_lock);
if (registered_in_use_objects.size()) {
- for (auto thread : registered_in_use_objects) {
- thread->Close();
+ for (auto& object : registered_in_use_objects) {
+ object->Close();
}
registered_in_use_objects.clear();
}