Fix crashes with MSVC on x86
authorSimon Hausmann <simon.hausmann@digia.com>
Wed, 26 Jun 2013 10:41:21 +0000 (12:41 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 26 Jun 2013 13:45:55 +0000 (15:45 +0200)
commit500f3c2848152aeb6aae320adfb32dd0b374e22b
tree0772a97225985424040810efa8c38f32cdb340a3
parent972094c109febebfb0376970bfc742d4200bcd14
Fix crashes with MSVC on x86

When returning a struct like QV4::Value from a function, the compiler can
either place the return value into the stack by expecting the caller
to provide a hidden first argument (pointer to where to store the value)
or pass it in eax:edx. The choice of which approach to pick depends on
whether the type is known at function declaration time. In this case we
had a mismatch where qv4serialize.cpp had a function that returned a value
and it is implemented by calling another function that would return the value.
QV4::Value was forward-declared, and so when compiling the function, the
compiler would assume that the caller provided an invisible first argument
for return value storage. The caller (in qquickworkerscript.cpp) however
had fully visibility of QV4::Value at call time and therefore assumed that
the value is returned in eax:edx. This mismatch caused naturally all sorts
of funny crashes.

The approach chosen is to eliminate any forward declarations of QV4::Value
and instead include the definition where appropriate.

Change-Id: I33303d86964239d3be30d1096806c605cddb7bbc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 files changed:
src/qml/qml/qqmlbinding_p.h
src/qml/qml/v4/moth/qv4vme_moth_p.h
src/qml/qml/v4/qv4context_p.h
src/qml/qml/v4/qv4engine_p.h
src/qml/qml/v4/qv4function_p.h
src/qml/qml/v4/qv4functionobject_p.h
src/qml/qml/v4/qv4global_p.h
src/qml/qml/v4/qv4jsir_p.h
src/qml/qml/v4/qv4object_p.h
src/qml/qml/v4/qv4objectiterator_p.h
src/qml/qml/v4/qv4serialize_p.h
src/qml/qml/v8/qv8engine_p.h