Fix debugger crash when using "info thread"

This commit is contained in:
svc64 2023-12-16 20:03:25 +02:00
parent 20e5eeb39e
commit eea36e8a37
2 changed files with 11 additions and 3 deletions

View file

@ -554,11 +554,17 @@ namespace Ryujinx.HLE.Debugger
void CommandSetThread(char op, ulong? threadId)
{
if (threadId == 0)
if (threadId == 0 || threadId == null)
{
threadId = GetThreads().First().ThreadUid;
}
if (DebugProcess.GetThread(threadId.Value) == null)
{
ReplyError();
return;
}
switch (op)
{
case 'c':

View file

@ -1306,7 +1306,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
{
lock (_parent._threadingLock)
{
return _parent._threads.Select(x => x.ThreadUid).ToArray();
var threads = _parent._threads.Where(x => !x.TerminationRequested).ToArray();
return threads.Select(x => x.ThreadUid).ToArray();
}
}
@ -1314,7 +1315,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
{
lock (_parent._threadingLock)
{
return _parent._threads.FirstOrDefault(x => x.ThreadUid == threadUid);
var threads = _parent._threads.Where(x => !x.TerminationRequested).ToArray();
return threads.FirstOrDefault(x => x.ThreadUid == threadUid);
}
}