mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 15:30:35 +00:00
Merge pull request #4079 from unknownbrackets/thread-funcs
Fix crash deleting a never started thread w/ clearstack
This commit is contained in:
commit
996e468562
@ -402,6 +402,7 @@ public:
|
||||
if (currentStack.start == (u32)-1)
|
||||
{
|
||||
currentStack.start = 0;
|
||||
nt.initialStack = 0;
|
||||
ERROR_LOG(SCEKERNEL, "Failed to allocate stack for thread");
|
||||
return false;
|
||||
}
|
||||
@ -437,8 +438,8 @@ public:
|
||||
if (currentStack.start != 0) {
|
||||
DEBUG_LOG(SCEKERNEL, "Freeing thread stack %s", nt.name);
|
||||
|
||||
if (nt.attr & PSP_THREAD_ATTR_CLEAR_STACK) {
|
||||
Memory::Memset(currentStack.start, 0, currentStack.end - currentStack.start);
|
||||
if ((nt.attr & PSP_THREAD_ATTR_CLEAR_STACK) != 0 && nt.initialStack != 0) {
|
||||
Memory::Memset(nt.initialStack, 0, nt.stackSize);
|
||||
}
|
||||
|
||||
if (nt.attr & PSP_THREAD_ATTR_KERNEL) {
|
||||
|
Loading…
Reference in New Issue
Block a user