From 8a6cc1572af899c0c720d03e6670286c3ef90f83 Mon Sep 17 00:00:00 2001 From: rw-r-r-0644 Date: Fri, 21 Sep 2018 20:24:40 +0200 Subject: [PATCH] threads/wiiu: fix crash on SDL_SYS_CreateThread: pass stack top and not stack bottom --- src/thread/wiiu/SDL_systhread.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/thread/wiiu/SDL_systhread.c b/src/thread/wiiu/SDL_systhread.c index 5a07a4904..364255339 100644 --- a/src/thread/wiiu/SDL_systhread.c +++ b/src/thread/wiiu/SDL_systhread.c @@ -48,17 +48,16 @@ thread_cleanup(OSThread *thread, void *stack) int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) { - unsigned int stackSize = thread->stacksize ? thread->stacksize : 0x8000; - int priority = OSGetThreadPriority(OSGetCurrentThread()); OSThread *handle = (OSThread *)memalign(16, sizeof(OSThread)); - char *stack = (char *)memalign(16, stackSize); - memset(handle, 0, sizeof(OSThread)); + unsigned int stackSize = thread->stacksize ? thread->stacksize : 0x8000; + void *stackTop = memalign(16, stackSize) + stackSize; + int priority = OSGetThreadPriority(OSGetCurrentThread()); if (!OSCreateThread(handle, (OSThreadEntryPointFn)SDL_RunThread, (int32_t)args, NULL, - stack, + stackTop, stackSize, priority, OS_THREAD_ATTRIB_AFFINITY_ANY))