diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 7dd775550..b04af4664 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -407,6 +407,12 @@ Kernel::Process::Process(KernelSystem& kernel) kernel.memory.RegisterPageTable(&vm_manager.page_table); } Kernel::Process::~Process() { + // Release all objects this process owns first so that their potential destructor can do clean + // up with this process before further destruction. + // TODO(wwylele): explicitly destroy or invalidate objects this process owns (threads, shared + // memory etc.) even if they are still referenced by other processes. + handle_table.Clear(); + kernel.memory.UnregisterPageTable(&vm_manager.page_table); } diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index a97630d2e..afc0b3bb1 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h @@ -94,7 +94,7 @@ private: /// Permission restrictions applied to other processes mapping the block. MemoryPermission other_permissions{}; /// Process that created this shared memory block. - SharedPtr owner_process; + Process* owner_process; /// Address of shared memory block in the owner process if specified. VAddr base_address = 0; /// Name of shared memory object.