Fix tst_qqmlecmascript::signalEmitted
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 7 Jun 2013 13:59:55 +0000 (15:59 +0200)
committerLars Knoll <lars.knoll@digia.com>
Fri, 7 Jun 2013 16:33:39 +0000 (18:33 +0200)
commit7426f1a5cad9b788aaea98130b06557c553f95e6
tree18163eeb9550ba4bd7d2d9f40f3b2a537aae45ad
parent20477daf07f2df99b7705ddafca6f8f1222863bf
Fix tst_qqmlecmascript::signalEmitted

This test executes code in the Component.onDestruction signal handler that ends
up doing things like allocating new V4 objects on the GC heap. Since Component.onDestruction
is called (indirectly) from QV4::QObjectWrapper::~QObjectWrapper(), we have a slight
problem:

From within the destructor of a garbage collected object, _during_ a sweep, we
end up trying to allocate new managed objects. Instead of adding more
complexity to the memory manager, this patch avoids doing clever things in the
destructor, by delaying the emission of the destructed signal to the point
right before the real deletion of the QObject (which was already delayed with a
deleteLater).

Change-Id: I15d5ad36feee930745e1a3a0efb5be9a302426d3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v4/qv4qobjectwrapper.cpp