From 58d69ed540fda74104d57dfd417fd7c3710809db Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Thu, 14 Nov 2019 20:42:16 +0100 Subject: frameworks:kirigami2: patched to fix a crash in systemsettings5 See: https://bugs.kde.org/show_bug.cgi?id=414003 https://bugs.kde.org/show_bug.cgi?id=414039 --- kde/patch/kirigami2.patch | 4 + kde/patch/kirigami2/kirigami_iconview_crash.patch | 143 ++++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 kde/patch/kirigami2.patch create mode 100644 kde/patch/kirigami2/kirigami_iconview_crash.patch (limited to 'kde/patch') diff --git a/kde/patch/kirigami2.patch b/kde/patch/kirigami2.patch new file mode 100644 index 0000000..960dd41 --- /dev/null +++ b/kde/patch/kirigami2.patch @@ -0,0 +1,4 @@ +# Fix crashes in systemsettings5 when visiting the second icon. +# Should be fixed post kirigami2 5.64.0): +cat $CWD/patch/kirigami2/kirigami_iconview_crash.patch | patch -p1 --verbose || { touch ${SLACK_KDE_BUILD_DIR}/${PKGNAME}.failed ; continue ; } + diff --git a/kde/patch/kirigami2/kirigami_iconview_crash.patch b/kde/patch/kirigami2/kirigami_iconview_crash.patch new file mode 100644 index 0000000..79a35ed --- /dev/null +++ b/kde/patch/kirigami2/kirigami_iconview_crash.patch @@ -0,0 +1,143 @@ +diff --git a/src/columnview.cpp b/src/columnview.cpp +--- a/src/columnview.cpp ++++ b/src/columnview.cpp +@@ -37,23 +37,37 @@ + public: + QmlComponentsPoolSingleton() + {} +- +- QmlComponentsPool self; ++ static QmlComponentsPool *instance(QQmlEngine *engine); ++private: ++ QHash m_instances; + }; + + Q_GLOBAL_STATIC(QmlComponentsPoolSingleton, privateQmlComponentsPoolSelf) + + +-QmlComponentsPool::QmlComponentsPool(QObject *parent) +- : QObject(parent) +-{} +- +-void QmlComponentsPool::initialize(QQmlEngine *engine) ++QmlComponentsPool *QmlComponentsPoolSingleton::instance(QQmlEngine *engine) + { +- if (!engine || m_instance) { +- return; ++ Q_ASSERT(engine); ++ auto componentPool = privateQmlComponentsPoolSelf->m_instances.value(engine); ++ ++ if (componentPool) { ++ return componentPool; + } + ++ componentPool = new QmlComponentsPool(engine); ++ ++ QObject::connect(componentPool, &QObject::destroyed, [engine]() { ++ if (privateQmlComponentsPoolSelf) { ++ privateQmlComponentsPoolSelf->m_instances.remove(engine); ++ } ++ }); ++ privateQmlComponentsPoolSelf->m_instances[engine] = componentPool; ++ return componentPool; ++} ++ ++QmlComponentsPool::QmlComponentsPool(QQmlEngine *engine) ++ : QObject(engine) ++{ + QQmlComponent *component = new QQmlComponent(engine, this); + + component->setData(QByteArrayLiteral("import QtQuick 2.7\n" +@@ -572,12 +586,12 @@ + QQuickItem *separatorItem = m_separators.value(item); + + if (!separatorItem) { +- separatorItem = qobject_cast(privateQmlComponentsPoolSelf->self.m_separatorComponent->beginCreate(QQmlEngine::contextForObject(item))); ++ separatorItem = qobject_cast(privateQmlComponentsPoolSelf->instance(qmlEngine(item))->m_separatorComponent->beginCreate(QQmlEngine::contextForObject(item))); + if (separatorItem) { + separatorItem->setParentItem(item); + separatorItem->setZ(9999); + separatorItem->setProperty("column", QVariant::fromValue(item)); +- privateQmlComponentsPoolSelf->self.m_separatorComponent->completeCreate(); ++ QmlComponentsPoolSingleton::instance(qmlEngine(item))->m_separatorComponent->completeCreate(); + m_separators[item] = separatorItem; + } + } +@@ -590,12 +604,12 @@ + QQuickItem *separatorItem = m_rightSeparators.value(item); + + if (!separatorItem) { +- separatorItem = qobject_cast(privateQmlComponentsPoolSelf->self.m_rightSeparatorComponent->beginCreate(QQmlEngine::contextForObject(item))); ++ separatorItem = qobject_cast(QmlComponentsPoolSingleton::instance(qmlEngine(item))->m_rightSeparatorComponent->beginCreate(QQmlEngine::contextForObject(item))); + if (separatorItem) { + separatorItem->setParentItem(item); + separatorItem->setZ(9999); + separatorItem->setProperty("column", QVariant::fromValue(item)); +- privateQmlComponentsPoolSelf->self.m_rightSeparatorComponent->completeCreate(); ++ QmlComponentsPoolSingleton::instance(qmlEngine(item))->m_rightSeparatorComponent->completeCreate(); + m_rightSeparators[item] = separatorItem; + } + } +@@ -759,7 +773,7 @@ + void ColumnView::setColumnWidth(qreal width) + { + // Always forget the internal binding when the user sets anything, even the same value +- disconnect(&privateQmlComponentsPoolSelf->self, &QmlComponentsPool::gridUnitChanged, this, nullptr); ++ disconnect(QmlComponentsPoolSingleton::instance(qmlEngine(this)), &QmlComponentsPool::gridUnitChanged, this, nullptr); + + if (m_contentItem->m_columnWidth == width) { + return; +@@ -902,7 +916,7 @@ + + void ColumnView::setScrollDuration(int duration) + { +- disconnect(&privateQmlComponentsPoolSelf->self, &QmlComponentsPool::longDurationChanged, this, nullptr); ++ disconnect(QmlComponentsPoolSingleton::instance(qmlEngine(this)), &QmlComponentsPool::longDurationChanged, this, nullptr); + + if (m_contentItem->m_slideAnim->duration() == duration) { + return; +@@ -1392,22 +1406,20 @@ + + void ColumnView::classBegin() + { +- privateQmlComponentsPoolSelf->self.initialize(qmlEngine(this)); +- + auto syncColumnWidth = [this]() { +- m_contentItem->m_columnWidth = privateQmlComponentsPoolSelf->self.m_units->property("gridUnit").toInt() * 20; ++ m_contentItem->m_columnWidth = privateQmlComponentsPoolSelf->instance(qmlEngine(this))->m_units->property("gridUnit").toInt() * 20; + emit columnWidthChanged(); + }; + +- connect(&privateQmlComponentsPoolSelf->self, &QmlComponentsPool::gridUnitChanged, this, syncColumnWidth); ++ connect(QmlComponentsPoolSingleton::instance(qmlEngine(this)), &QmlComponentsPool::gridUnitChanged, this, syncColumnWidth); + syncColumnWidth(); + + auto syncDuration = [this]() { +- m_contentItem->m_slideAnim->setDuration(privateQmlComponentsPoolSelf->self.m_units->property("longDuration").toInt()); ++ m_contentItem->m_slideAnim->setDuration(QmlComponentsPoolSingleton::instance(qmlEngine(this))->m_units->property("longDuration").toInt()); + emit scrollDurationChanged(); + }; + +- connect(&privateQmlComponentsPoolSelf->self, &QmlComponentsPool::longDurationChanged, this, syncDuration); ++ connect(QmlComponentsPoolSingleton::instance(qmlEngine(this)), &QmlComponentsPool::longDurationChanged, this, syncDuration); + syncDuration(); + + QQuickItem::classBegin(); +diff --git a/src/columnview_p.h b/src/columnview_p.h +--- a/src/columnview_p.h ++++ b/src/columnview_p.h +@@ -32,11 +32,9 @@ + Q_OBJECT + + public: +- QmlComponentsPool(QObject *parent = nullptr); ++ QmlComponentsPool(QQmlEngine *engine); + ~QmlComponentsPool(); + +- void initialize(QQmlEngine *engine); +- + QQmlComponent *m_separatorComponent = nullptr; + QQmlComponent *m_rightSeparatorComponent = nullptr; + QObject *m_units = nullptr; + + -- cgit v1.2.3