aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4mm.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2014-01-13 11:09:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-15 10:45:05 +0100
commit14ebfef611d5703e3a2d74cfb5a42f93e66644a6 (patch)
treef81961083f3e5aa16ee45101e5c2b1d63e91945c /src/qml/jsruntime/qv4mm.cpp
parent51f4f6f0c376607543cf046fb27b199aecac0912 (diff)
Do not crash if /proc is not mounted
When proc is not mounted pthread_getattr_np fails, so default to 1MB stack in getStackLimit and to exactGC in MemoryManager Change-Id: Ic7515fd420f2d39a656808d24a3915a657722891 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4mm.cpp')
-rw-r--r--src/qml/jsruntime/qv4mm.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index f67efaffb9..9923c8834c 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -234,12 +234,17 @@ MemoryManager::MemoryManager()
# 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 (pthread_getattr_np(pthread_self(), &attr) == 0) {
+ size_t stackSize = 0;
+ pthread_attr_getstack(&attr, &stackBottom, &stackSize);
+ pthread_attr_destroy(&attr);
- m_d->stackTop = static_cast<quintptr *>(stackBottom) + stackSize/sizeof(quintptr);
+ m_d->stackTop = static_cast<quintptr *>(stackBottom) + stackSize/sizeof(quintptr);
+ } else {
+ // can't scan the native stack so have to rely on exact gc
+ m_d->stackTop = 0;
+ m_d->exactGC = true;
+ }
# endif
#elif OS(WINCE)
if (false && g_stackBase) {