aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2013-11-20 17:17:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-20 17:53:45 +0100
commit88262738a8109f393f5e34d5898d1610d490e6f6 (patch)
tree192f5f885ed820194af24b82e2bde2b2c6f423d0 /src/qml/jsruntime
parent61cf2b0633e8af564d1368dc377da0b6869fb4c9 (diff)
V4 Use getrlimit on Darwin to get the stack size for the main thread
Turns out pthread_get_size does not return the correct size when it is called from the main thread, so to workaround you call getrlimit instead Without this change, most QML applications are broken on iOS. Change-Id: I9a61494de26caa3d7be7e46a991e6d6d0514ce17 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp9
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;