diff options
author | bunnei <bunneidev@gmail.com> | 2021-11-02 04:11:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 04:11:30 +0100 |
commit | b118fa8698dbe0e2b6e663c1c37a7eac03422905 (patch) | |
tree | 14864116c00d385abba61ad2330c1c0f50e4b961 /src/core/hle/kernel/svc.cpp | |
parent | Merge pull request #7264 from zhaobot/tx-update-20211101021628 (diff) | |
parent | Fix dangling kernel objects when exiting (diff) | |
download | yuzu-b118fa8698dbe0e2b6e663c1c37a7eac03422905.tar yuzu-b118fa8698dbe0e2b6e663c1c37a7eac03422905.tar.gz yuzu-b118fa8698dbe0e2b6e663c1c37a7eac03422905.tar.bz2 yuzu-b118fa8698dbe0e2b6e663c1c37a7eac03422905.tar.lz yuzu-b118fa8698dbe0e2b6e663c1c37a7eac03422905.tar.xz yuzu-b118fa8698dbe0e2b6e663c1c37a7eac03422905.tar.zst yuzu-b118fa8698dbe0e2b6e663c1c37a7eac03422905.zip |
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 7f38ade1c..c43135856 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -427,11 +427,15 @@ static ResultCode WaitSynchronization(Core::System& system, s32* index, VAddr ha R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>(objs.data(), handles, num_handles), ResultInvalidHandle); + for (const auto& obj : objs) { + kernel.RegisterInUseObject(obj); + } } // Ensure handles are closed when we're done. SCOPE_EXIT({ for (u64 i = 0; i < num_handles; ++i) { + kernel.UnregisterInUseObject(objs[i]); objs[i]->Close(); } }); @@ -1561,6 +1565,7 @@ static ResultCode StartThread(Core::System& system, Handle thread_handle) { // If we succeeded, persist a reference to the thread. thread->Open(); + system.Kernel().RegisterInUseObject(thread.GetPointerUnsafe()); return ResultSuccess; } @@ -1576,6 +1581,7 @@ static void ExitThread(Core::System& system) { auto* const current_thread = system.Kernel().CurrentScheduler()->GetCurrentThread(); system.GlobalSchedulerContext().RemoveThread(current_thread); current_thread->Exit(); + system.Kernel().UnregisterInUseObject(current_thread); } static void ExitThread32(Core::System& system) { |