mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-27 14:49:05 +00:00
Fix ProcessLoader stale PID validation against kernel process table (#102)
This PR adresses the following issue : `ProcessLoader.ActiveApplication` could return invalid results when `_latestPid` pointed to a process that no longer existed in the kernel's process table. The original exception path was commented out and bypassed (by sh0inx?) with `GetValueOrDefault` to prevent UI lockups, but this only resolved the symptoms without fixing the root cause. This was due to sevral factors : - `_latestPid` was never reset or validated against the actual process state - ProcessLoader maintained its own `_processesByPid` dictionary separate from the kernel's `KernelContext.Processes` - No cleanups happened when processes exited or were terminated - ProcessLoader state could drift out of sync with the kernel process table **Solution/Fixes** - Validate` _latestPid` against the kernel process table before returning `ActiveApplication` - Check process state (Exited/Exiting) and automatically clear stale references - Add thread-safe cleanup methods (`ClearProcess`, `ClearAllProcesses`) - Integrate `ClearAllProcesses` into Switch.Dispose for proper shutdown cleanup - Add warning logs when stale PID is detected and cleared for debugging **Code Changes**: - `ProcessLoader.cs`: Add `_pidLock`, update `ActiveApplication` with validation, add cleanup methods - `Switch.cs`: Call `Processes.ClearAllProcesses()` in Dispose() Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/102
This commit is contained in:
@@ -183,6 +183,7 @@ namespace Ryujinx.HLE
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
Processes.ClearAllProcesses();
|
||||
System.Dispose();
|
||||
AudioDeviceDriver.Dispose();
|
||||
FileSystem.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user