Rework QObject deletion mechanism
authorSimon Hausmann <simon.hausmann@digia.com>
Thu, 13 Jun 2013 13:27:00 +0000 (15:27 +0200)
committerLars Knoll <lars.knoll@digia.com>
Thu, 13 Jun 2013 15:50:27 +0000 (17:50 +0200)
commite93d3a57f07f7f2cdb8f2fb42c30d731e0097c91
treed8f84305bedd6fd49e253540cc7366306a9993d1
parente06676db83483d83260f7e04bd1ae2024d8b5030
Rework QObject deletion mechanism

Instead of the qv4mm knowing about different ways of deleting the QObjects
of the QObject JS wrappers (and their timing!), provide an interface between
the two.

Before destroying a managed object, we allow for the object to register a
Deletable instance in a singly linked list of deletable objects that will be
deleted right after the sweep, but before the gc returns to application.

This allows for a behavior that is identical with V8: When GC runs, the
QML Component.onDestruction callbacks are called _after_ the sweep but
before returning to the application. The QObject however is deleted later,
unless this is the very last run of the GC (as indicated by the lastCall
property).

Change-Id: I1a2f127f4634c7ecc8c89b45e8b0a575c0ef772e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v4/qv4managed.cpp
src/qml/qml/v4/qv4managed_p.h
src/qml/qml/v4/qv4mm.cpp
src/qml/qml/v4/qv4mm_p.h
src/qml/qml/v4/qv4qobjectwrapper.cpp
src/qml/qml/v4/qv4qobjectwrapper_p.h
src/qml/qml/v4/qv4string.cpp