Prevent some threading related NULL derefs.
This commit is contained in:
parent
3931f07852
commit
f91135cedf
1 changed files with 8 additions and 4 deletions
|
@ -651,8 +651,12 @@ private:
|
|||
int size = cur->end - cur->first;
|
||||
if (size >= cur->capacity - 2)
|
||||
{
|
||||
cur->capacity *= 2;
|
||||
cur->data = (SceUID *)realloc(cur->data, cur->capacity * sizeof(SceUID));
|
||||
SceUID *new_data = (SceUID *)realloc(cur->data, cur->capacity * sizeof(SceUID));
|
||||
if (new_data != NULL)
|
||||
{
|
||||
cur->capacity *= 2;
|
||||
cur->data = new_data;
|
||||
}
|
||||
}
|
||||
|
||||
int newFirst = (cur->capacity - size) / 2;
|
||||
|
@ -2735,6 +2739,8 @@ void __KernelSwitchContext(Thread *target, const char *reason)
|
|||
hleCurrentThreadName = target->nt.name;
|
||||
__KernelChangeReadyState(target, currentThread, false);
|
||||
target->nt.status = (target->nt.status | THREADSTATUS_RUNNING) & ~THREADSTATUS_READY;
|
||||
|
||||
__KernelLoadContext(&target->context, (target->nt.attr & PSP_THREAD_ATTR_VFPU) != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2742,8 +2748,6 @@ void __KernelSwitchContext(Thread *target, const char *reason)
|
|||
hleCurrentThreadName = NULL;
|
||||
}
|
||||
|
||||
__KernelLoadContext(&target->context, (target->nt.attr & PSP_THREAD_ATTR_VFPU) != 0);
|
||||
|
||||
bool fromIdle = oldUID == threadIdleID[0] || oldUID == threadIdleID[1];
|
||||
bool toIdle = currentThread == threadIdleID[0] || currentThread == threadIdleID[1];
|
||||
if (!(fromIdle && toIdle))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue