Fix crashes when GC triggers inside allocation inside initCallContext
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 28 Jun 2013 10:13:06 +0000 (12:13 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 28 Jun 2013 20:48:52 +0000 (22:48 +0200)
commitb1eb8d37c505cba6692dd35c6cb84767a0045f8f
treed06610ea19b918e3274fed74572514692d8829bc
parenta9bca0681e82fc9628ce4163c09c5fb17f77b99a
Fix crashes when GC triggers inside allocation inside initCallContext

initCallContext allocates new managed memory required for the implementation of
the arguments objects. During that allocation a GC may happen itself, and it
may happen in turn that objects the context "owns" don't get marked.

This patch makes sure that newly allocated contexts are included in the chain
of contexts to mark by setting engine->current and context->parent early on,
before init*Context() can do any allocations.

Fixes tst_qjsvalue with MM_AGGRESSIVE_GC=1

Change-Id: Iebd444631691b6d00da8cfd20a1f760a5e73ac56
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v4/qv4context.cpp
src/qml/qml/v4/qv4context_p.h
src/qml/qml/v4/qv4engine.cpp