diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index be18b2c39..7f6046a8f 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -60,12 +60,7 @@ void Thread::Acquire(Thread* thread) { Thread::Thread(KernelSystem& kernel, u32 core_id) : WaitObject(kernel), core_id(core_id), thread_manager(kernel.GetThreadManager(core_id)) {} -Thread::~Thread() { - auto process = owner_process.lock(); - if (process) { - process->resource_limit->Release(ResourceLimitType::Thread, 1); - } -} +Thread::~Thread() = default; Thread* ThreadManager::GetCurrentThread() const { return current_thread.get(); @@ -101,6 +96,7 @@ void Thread::Stop() { ((tls_address - Memory::TLS_AREA_VADDR) % Memory::CITRA_PAGE_SIZE) / Memory::TLS_ENTRY_SIZE; if (auto process = owner_process.lock()) { process->tls_slots[tls_page].reset(tls_slot); + process->resource_limit->Release(ResourceLimitType::Thread, 1); } } diff --git a/src/core/hle/service/plgldr/plgldr.cpp b/src/core/hle/service/plgldr/plgldr.cpp index 5b2e32297..ad22b98cf 100644 --- a/src/core/hle/service/plgldr/plgldr.cpp +++ b/src/core/hle/service/plgldr/plgldr.cpp @@ -288,6 +288,9 @@ void PLG_LDR::GetPluginPath(Kernel::HLERequestContext& ctx) { } std::shared_ptr GetService(Core::System& system) { + if (!system.IsPoweredOn()) { + return nullptr; + } return system.ServiceManager().GetService("plg:ldr"); }