aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-05-11 19:57:21 -0300
committerGitHub <noreply@github.com>2021-05-12 00:57:21 +0200
commita8022ca3a1c9c2f312855c7676454507031be644 (patch)
tree34f91bb8fb89741634818064f5e955ad3c245771 /Ryujinx.HLE
parentebdbaa6db05057a5747cc96849922135a8b07994 (diff)
Fix race in SM initialization (#2280)
Diffstat (limited to 'Ryujinx.HLE')
-rw-r--r--Ryujinx.HLE/HOS/Horizon.cs2
-rw-r--r--Ryujinx.HLE/HOS/Services/ServerBase.cs5
2 files changed, 4 insertions, 3 deletions
diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs
index c240d135..d8e1605a 100644
--- a/Ryujinx.HLE/HOS/Horizon.cs
+++ b/Ryujinx.HLE/HOS/Horizon.cs
@@ -274,7 +274,7 @@ namespace Ryujinx.HLE.HOS
public void InitializeServices()
{
IUserInterface sm = new IUserInterface(KernelContext);
- sm.TrySetServer(new ServerBase(KernelContext, "SmServer") { SmObjectFactory = () => new IUserInterface(KernelContext) });
+ sm.TrySetServer(new ServerBase(KernelContext, "SmServer", () => new IUserInterface(KernelContext)));
// Wait until SM server thread is done with initialization,
// only then doing connections to SM is safe.
diff --git a/Ryujinx.HLE/HOS/Services/ServerBase.cs b/Ryujinx.HLE/HOS/Services/ServerBase.cs
index 5b9834dc..c9d009a9 100644
--- a/Ryujinx.HLE/HOS/Services/ServerBase.cs
+++ b/Ryujinx.HLE/HOS/Services/ServerBase.cs
@@ -38,13 +38,14 @@ namespace Ryujinx.HLE.HOS.Services
private readonly Dictionary<int, Func<IpcService>> _ports = new Dictionary<int, Func<IpcService>>();
public ManualResetEvent InitDone { get; }
- public Func<IpcService> SmObjectFactory { get; set; }
+ public Func<IpcService> SmObjectFactory { get; }
public string Name { get; }
- public ServerBase(KernelContext context, string name)
+ public ServerBase(KernelContext context, string name, Func<IpcService> smObjectFactory = null)
{
InitDone = new ManualResetEvent(false);
Name = name;
+ SmObjectFactory = smObjectFactory;
_context = context;
const ProcessCreationFlags flags =