diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-18 19:17:30 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-18 19:17:30 +0100 |
commit | 9f38956fc9a58a2fdfd83c91d65502964047eda3 (patch) | |
tree | 3156fa78c621e3588b230d8334944d4c9e857d45 /src/qml/jsruntime | |
parent | 57cd6337a87f4a8a77ea7136c60a32d2825426df (diff) | |
parent | 839d2d3e2368bc8e107d22203b0611c852f54319 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
Change-Id: I9588a3e2c7d590e031dd4c66905a79f0d74d3ac8
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4persistent.cpp | 7 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper_p.h | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp index 4a0f84b685..032ad0d00a 100644 --- a/src/qml/jsruntime/qv4persistent.cpp +++ b/src/qml/jsruntime/qv4persistent.cpp @@ -34,6 +34,7 @@ #include "qv4persistent_p.h" #include <private/qv4mm_p.h> #include "qv4object_p.h" +#include "qv4qobjectwrapper_p.h" #include "PageAllocation.h" using namespace QV4; @@ -204,6 +205,12 @@ void PersistentValueStorage::free(Value *v) Page *p = getPage(v); + // Keep track of QObjectWrapper to release its resources later in MemoryManager::sweep() + if (p->header.engine) { + if (QObjectWrapper *qobjectWrapper = v->as<QObjectWrapper>()) + p->header.engine->memoryManager->m_pendingDestroyedObjectWrappers.push_back(qobjectWrapper->d()); + } + v->setTag(QV4::Value::Empty_Type); v->setInt_32(p->header.freeList); p->header.freeList = v - p->values; diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index ee294b3678..594df67f44 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1019,6 +1019,11 @@ void QObjectWrapper::markObjects(Heap::Base *that, QV4::ExecutionEngine *e) void QObjectWrapper::destroyObject(bool lastCall) { Heap::QObjectWrapper *h = d(); + destroyObject(h, lastCall); +} + +void QObjectWrapper::destroyObject(Heap::QObjectWrapper *h, bool lastCall) +{ if (!h->internalClass) return; // destroyObject already got called diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index 1126013806..29e1263f2d 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -120,6 +120,7 @@ struct Q_QML_EXPORT QObjectWrapper : public Object void setProperty(ExecutionEngine *engine, int propertyIndex, const Value &value); void destroyObject(bool lastCall); + static void destroyObject(Heap::QObjectWrapper *h, bool lastCall); protected: static bool isEqualTo(Managed *that, Managed *o); |