Fix exception when NtTerminateThread is called on the active thread.

This commit is contained in:
Red
2025-08-22 00:32:05 +02:00
parent 7605309317
commit 257d9f6d02

View File

@@ -52,6 +52,7 @@ namespace
void perform_context_switch_work(windows_emulator& win_emu)
{
auto& threads = win_emu.process.threads;
auto*& active = win_emu.process.active_thread;
for (auto it = threads.begin(); it != threads.end();)
{
@@ -61,6 +62,11 @@ namespace
continue;
}
if (active == &it->second)
{
active = nullptr;
}
const auto [new_it, deleted] = threads.erase(it);
if (!deleted)
{