summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
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 f98f24a60..d30755b7e 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();
}
});
@@ -1544,6 +1548,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;
}
@@ -1559,6 +1564,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) {