diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-12-16 21:44:06 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-17 01:44:06 +0100 |
| commit | f5d64b4d68ac93c1abef8ae2fd17c101f7da6ce5 (patch) | |
| tree | 9f5bee439d3de3ef9ce885ac33c5bf7501641e24 | |
| parent | e901b7850c74ee3650ef4ea887e4b43db36438c5 (diff) | |
Terminate application before services (#1812)
* Terminate application before services
* Use flags instead of title ID
| -rw-r--r-- | Ryujinx.HLE/HOS/Horizon.cs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs index e6e9cbb0..9309ae41 100644 --- a/Ryujinx.HLE/HOS/Horizon.cs +++ b/Ryujinx.HLE/HOS/Horizon.cs @@ -32,6 +32,7 @@ using Ryujinx.HLE.Loaders.Executables; using Ryujinx.HLE.Utilities; using System; using System.IO; +using System.Linq; using System.Threading; namespace Ryujinx.HLE.HOS @@ -318,8 +319,6 @@ namespace Ryujinx.HLE.HOS _isDisposed = true; - SurfaceFlinger.Dispose(); - KProcess terminationProcess = new KProcess(KernelContext); KThread terminationThread = new KThread(KernelContext); @@ -328,7 +327,18 @@ namespace Ryujinx.HLE.HOS // Force all threads to exit. lock (KernelContext.Processes) { - foreach (KProcess process in KernelContext.Processes.Values) + // Terminate application. + foreach (KProcess process in KernelContext.Processes.Values.Where(x => x.Flags.HasFlag(ProcessCreationFlags.IsApplication))) + { + process.Terminate(); + } + + // The application existed, now surface flinger can exit too. + SurfaceFlinger.Dispose(); + + // Terminate HLE services (must be done after the application is already terminated, + // otherwise the application will receive errors due to service termination. + foreach (KProcess process in KernelContext.Processes.Values.Where(x => !x.Flags.HasFlag(ProcessCreationFlags.IsApplication))) { process.Terminate(); } |
