summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-11-02 04:11:30 +0100
committerGitHub <noreply@github.com>2021-11-02 04:11:30 +0100
commitb118fa8698dbe0e2b6e663c1c37a7eac03422905 (patch)
tree14864116c00d385abba61ad2330c1c0f50e4b961 /src/core/hle/kernel/svc.cpp
parentMerge pull request #7264 from zhaobot/tx-update-20211101021628 (diff)
parentFix dangling kernel objects when exiting (diff)
downloadyuzu-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.cpp6
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) {