Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

hle: kernel: Ensure current running process is closed.

bunnei81d111fd1b1b
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index b7f9eb5c1d..2d5525839b 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -91,6 +91,12 @@ struct KernelCore::Impl {
}
void Shutdown() {
+ if (current_process) {
+ current_process->Finalize();
+ current_process->Close();
+ current_process = nullptr;
+ }
+
process_list.clear();
// Ensures all service threads gracefully shutdown
@@ -112,11 +118,6 @@ struct KernelCore::Impl {
cores.clear();
- if (current_process) {
- current_process->Close();
- current_process = nullptr;
- }
-
global_handle_table->Finalize();
global_handle_table.reset();