libqt5-qtdeclarative/rebuild-qqmldata-propertycache-if-deleted.patch
Dominique Leuenberger 06030bbdf3 Accepting request 511037 from KDE:Qt5
- Add patch to fix crash related to shared QQmlEngine instances
  (QTBUG-61681, kde#381525):
  * rebuild-qqmldata-propertycache-if-deleted.patch

OBS-URL: https://build.opensuse.org/request/show/511037
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtdeclarative?expand=0&rev=40
2017-07-25 09:35:41 +00:00

41 lines
1.5 KiB
Diff

From ab5d4c78224c9ec79165e8890e5f8b8e838e0709 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Mon, 10 Jul 2017 17:26:59 +0100
Subject: [PATCH] Rebuild QQmlData::propertyCache if deleted by another engine
QQmlData is shared between engines, but the relevant QObjectWrapper is
not. Since 749a7212e903d8e8c6f256edb1836b9449cc7fe1 when a
QObjectWrapper is deleted it resets the shared QQmlData propertyCache.
In most cases the propertyCache except when a property updated in an
existing binding in the first engine, where it currently asserts.
Task-number: QTBUG-61681
Change-Id: I6efdc506e5c7e30b95cda1be282afa9feb781cd2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
---
src/qml/qml/qqmlbinding.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 62288a5..325f752 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -515,7 +515,12 @@ void QQmlBinding::getPropertyData(QQmlPropertyData **propertyData, QQmlPropertyD
Q_ASSERT(propertyData);
QQmlData *data = QQmlData::get(*m_target, false);
- Q_ASSERT(data && data->propertyCache);
+ Q_ASSERT(data);
+
+ if (Q_UNLIKELY(!data->propertyCache)) {
+ data->propertyCache = QQmlEnginePrivate::get(context()->engine)->cache(m_target->metaObject());
+ data->propertyCache->addref();
+ }
*propertyData = data->propertyCache->property(m_targetIndex.coreIndex());
Q_ASSERT(*propertyData);
--
2.7.4