|
|
87539d |
From 73e8321255d9f0e70529a58c10dbaf4790a9a659 Mon Sep 17 00:00:00 2001
|
|
|
87539d |
From: David Edmundson <davidedmundson@kde.org>
|
|
|
87539d |
Date: Tue, 6 Mar 2018 10:56:23 +0000
|
|
|
87539d |
Subject: [PATCH 28/29] Rebuild property cache in QObjectWrapper::getProperty
|
|
|
87539d |
if deleted
|
|
|
87539d |
|
|
|
87539d |
QQmlData is shared between engines, but the relevant QObjectWrapper is
|
|
|
87539d |
not.
|
|
|
87539d |
|
|
|
87539d |
Since 749a7212e903d8e8c6f256edb1836b9449cc7fe1 when a QObjectWrapper is
|
|
|
87539d |
deleted it resets the shared QQmlData propertyCache.
|
|
|
87539d |
|
|
|
87539d |
ab5d4c78224c9ec79165e8890e5f8b8e838e0709 fixed this situation for
|
|
|
87539d |
bindings, however we would still hit effectively the same crash in the
|
|
|
87539d |
same situation if a function is evaluated before a binding.
|
|
|
87539d |
|
|
|
87539d |
Change-Id: I20cd91cd8e31fd0176d542822c67e81a790599ba
|
|
|
87539d |
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
87539d |
---
|
|
|
87539d |
src/qml/jsruntime/qv4qobjectwrapper.cpp | 5 +++++
|
|
|
87539d |
1 file changed, 5 insertions(+)
|
|
|
87539d |
|
|
|
87539d |
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
|
|
|
87539d |
index 5ebd385cf..c1bbe2a33 100644
|
|
|
87539d |
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
|
|
|
87539d |
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
|
|
|
87539d |
@@ -335,6 +335,11 @@ ReturnedValue QObjectWrapper::getProperty(ExecutionEngine *engine, QObject *obje
|
|
|
87539d |
if (!ddata)
|
|
|
87539d |
return QV4::Encode::undefined();
|
|
|
87539d |
|
|
|
87539d |
+ if (Q_UNLIKELY(!ddata->propertyCache)) {
|
|
|
87539d |
+ ddata->propertyCache = QQmlEnginePrivate::get(engine)->cache(object->metaObject());
|
|
|
87539d |
+ ddata->propertyCache->addref();
|
|
|
87539d |
+ }
|
|
|
87539d |
+
|
|
|
87539d |
QQmlPropertyCache *cache = ddata->propertyCache;
|
|
|
87539d |
Q_ASSERT(cache);
|
|
|
87539d |
QQmlPropertyData *property = cache->property(propertyIndex);
|
|
|
87539d |
--
|
|
|
87539d |
2.14.3
|
|
|
87539d |
|