aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-01-17 07:11:26 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-01-17 07:12:23 +0100
commitf596553e03c3969f6e7cb5344c05591da6e70dfb (patch)
tree8aef667749e1adc015cbc9c5ec5b5af9c6d4c15c /src/qml/jsruntime/qv4engine.cpp
parente32845b137834ef46d68345a0029d4af7c1d85bb (diff)
parent7030adff1869e850a7b983e88d7a773d5d594886 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: .qmake.conf src/imports/dialogs/DefaultFileDialog.qml src/imports/widgets/qquickqfiledialog.cpp Change-Id: I00de6dd05cb773f01254061d585a82c90b229acd
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 384254f896..5de8e0de44 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -109,21 +109,28 @@ quintptr getStackLimit()
# else
void* stackBottom = 0;
pthread_attr_t attr;
- pthread_getattr_np(pthread_self(), &attr);
- size_t stackSize = 0;
- pthread_attr_getstack(&attr, &stackBottom, &stackSize);
- pthread_attr_destroy(&attr);
-
-# if defined(Q_OS_ANDROID)
- // Bionic pretends that the main thread has a tiny stack; work around it
- if (gettid() == getpid()) {
- rlimit limit;
- getrlimit(RLIMIT_STACK, &limit);
- stackBottom = reinterpret_cast<void*>(reinterpret_cast<quintptr>(stackBottom) + stackSize - limit.rlim_cur);
+ if (pthread_getattr_np(pthread_self(), &attr) == 0) {
+ size_t stackSize = 0;
+ pthread_attr_getstack(&attr, &stackBottom, &stackSize);
+ pthread_attr_destroy(&attr);
+
+# if defined(Q_OS_ANDROID)
+ // Bionic pretends that the main thread has a tiny stack; work around it
+ if (gettid() == getpid()) {
+ rlimit limit;
+ getrlimit(RLIMIT_STACK, &limit);
+ stackBottom = reinterpret_cast<void*>(reinterpret_cast<quintptr>(stackBottom) + stackSize - limit.rlim_cur);
+ }
+# endif
+
+ stackLimit = reinterpret_cast<quintptr>(stackBottom);
+ } else {
+ int dummy;
+ // this is inexact, as part of the stack is used when being called here,
+ // but let's simply default to 1MB from where the stack is right now
+ stackLimit = reinterpret_cast<qintptr>(&dummy) - 1024*1024;
}
-# endif
- stackLimit = reinterpret_cast<quintptr>(stackBottom);
# endif
// This is wrong. StackLimit is the currently committed stack size, not the real end.
// only way to get that limit is apparently by using VirtualQuery (Yuck)