Prevent destroying active thread

This commit is contained in:
Maurice Heumann
2025-02-04 20:43:43 +01:00
parent cc4064611f
commit 85180a51f0

View File

@@ -430,6 +430,16 @@ namespace
return STATUS_SUCCESS;
}
if (h.value.type == handle_types::thread)
{
const auto t = c.proc.threads.get(h);
if (t == c.proc.active_thread && t->ref_count == 1)
{
// TODO: Better handle ref counting
return STATUS_SUCCESS;
}
}
auto* handle_store = get_handle_store(c.proc, h);
if (handle_store && handle_store->erase(h))
{