diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 84be89d31a..8cd059dd2b 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -95,7 +95,14 @@ quintptr getStackLimit() pthread_t thread_self = pthread_self(); void *stackTop = pthread_get_stackaddr_np(thread_self); stackLimit = reinterpret_cast<quintptr>(stackTop); - stackLimit -= pthread_get_stacksize_np(thread_self); + quintptr size = 0; + if (pthread_main_np()) { + rlimit limit; + getrlimit(RLIMIT_STACK, &limit); + size = limit.rlim_cur; + } else + size = pthread_get_stacksize_np(thread_self); + stackLimit -= size; # else void* stackBottom = 0; pthread_attr_t attr; |