From 4a28d8cebbe83d05e8a2454bbfddeeb4fe2833ae Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 11 Mar 2022 00:14:13 -0800 Subject: core: hle: kernel: k_thread: Ensure host Fiber is freed. --- src/core/hle/kernel/k_thread.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/hle/kernel/k_thread.cpp') diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index de3ffe0c7..736f39e91 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp @@ -326,6 +326,9 @@ void KThread::Finalize() { } } + // Release host emulation members. + host_context.reset(); + // Perform inherited finalization. KSynchronizationObject::Finalize(); } -- cgit v1.2.3 From 813b2ef2530433c95abca97254c5b614f3d8c615 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 11 Mar 2022 17:14:17 -0800 Subject: core: hle: kernel: k_process: Implement thread local storage accurately. --- src/core/hle/kernel/k_thread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle/kernel/k_thread.cpp') diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index 736f39e91..ba7f72c6b 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp @@ -210,7 +210,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s if (owner != nullptr) { // Setup the TLS, if needed. if (type == ThreadType::User) { - tls_address = owner->CreateTLSRegion(); + R_TRY(owner->CreateThreadLocalRegion(std::addressof(tls_address))); } parent = owner; @@ -305,7 +305,7 @@ void KThread::Finalize() { // If the thread has a local region, delete it. if (tls_address != 0) { - parent->FreeTLSRegion(tls_address); + ASSERT(parent->DeleteThreadLocalRegion(tls_address).IsSuccess()); } // Release any waiters. -- cgit v1.2.3