From a493ab2678078ce2066e8120ec93c0f6b4274df6 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 7 Jun 2021 21:10:51 -0700 Subject: hle: kernel: Remove service thread manager and use weak_ptr. - We no longer need to queue up service threads to be destroyed. - Fixes a race condition where a thread could be destroyed too early, which caused a crash in Pokemon Sword/Shield. --- src/core/hle/kernel/hle_ipc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core/hle/kernel/hle_ipc.h') diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 2aaf93fca..159565203 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -85,8 +85,8 @@ public: */ void ClientDisconnected(KServerSession* session); - std::shared_ptr GetServiceThread() const { - return service_thread.lock(); + std::weak_ptr GetServiceThread() const { + return service_thread; } protected: @@ -152,7 +152,7 @@ public: session_handler = std::move(handler); } - std::shared_ptr GetServiceThread() const { + std::weak_ptr GetServiceThread() const { return session_handler->GetServiceThread(); } -- cgit v1.2.3 From 08d798b6fe8b09f28c0302b52c3b832b786d1b8a Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 7 Jun 2021 21:55:37 -0700 Subject: hle: kernel: hle_ipc: Ensure SessionRequestHandler is valid. --- src/core/hle/kernel/hle_ipc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/hle/kernel/hle_ipc.h') diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 159565203..a61870f8b 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -156,6 +156,8 @@ public: return session_handler->GetServiceThread(); } + bool HasSessionRequestHandler(const HLERequestContext& context) const; + private: bool is_domain{}; SessionRequestHandlerPtr session_handler; @@ -163,7 +165,6 @@ private: private: KernelCore& kernel; - std::weak_ptr service_thread; }; /** -- cgit v1.2.3