From c220a6f0ff9a4f3f80830806d0ddeb0115c6838d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 29 May 2013 14:58:52 +0200 Subject: Fix tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy When destructing the JS engine and deleting the JS wrappers, we may decide to delete the QObjects of JS owned JS QObject wrappers. During this phase (engine destruction) we need to delete the QObject instantly instead of deferred (the default when _running_ the engine). * Delete the memory manager first in the ExecutionEngine destructor, as some of the user code destructors we may end up calling still expect a somewhat functioning engine unfortunately. * Fixed also some bugs in Persistent/WeakValue: When assing a value, detach properly if refcount > 0 * Fixed a bug when clearing a weak value during sweep, when we wouldn't pick up the correct next pointer for a weak value that didn't have the mark bit set Change-Id: I960e58ecbb40b0ecf2bc07fe661a1ec706fcca61 Reviewed-by: Lars Knoll --- src/qml/qml/qqmlvmemetaobject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/qml/qml/qqmlvmemetaobject.cpp') diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index ace9ff9a65..09edd3af89 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -73,7 +73,8 @@ void QQmlVMEVariantQObjectPtr::objectDestroyed(QObject *) if (m_isVar && m_target->varPropertiesInitialized && !m_target->varProperties.isEmpty()) { // Set the var property to NULL QV4::ArrayObject *a = m_target->varProperties.value().asArrayObject(); - a->putIndexed(m_index - m_target->firstVarPropertyIndex, QV4::Value::nullValue()); + if (a) + a->putIndexed(m_index - m_target->firstVarPropertyIndex, QV4::Value::nullValue()); } m_target->activate(m_target->object, m_target->methodOffset() + m_index, 0); -- cgit v1.2.3