public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Aric Belsito" <lluixhi@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/musl:master commit in: dev-qt/qtcore/files/, dev-qt/qtcore/
Date: Mon, 24 Apr 2017 03:02:22 +0000 (UTC)	[thread overview]
Message-ID: <1493002902.d9e34eb40544eba511b2cf9da866edf8cb4c27d5.lluixhi@gentoo> (raw)

commit:     d9e34eb40544eba511b2cf9da866edf8cb4c27d5
Author:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
AuthorDate: Mon Apr 24 03:01:42 2017 +0000
Commit:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Mon Apr 24 03:01:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=d9e34eb4

dev-qt/qtcore: version bump to 5.7.1-r3

 dev-qt/qtcore/Manifest                         |   4 +
 dev-qt/qtcore/files/qtcore-5.7.1-qipm.patch    | 152 +++++++++++++++
 dev-qt/qtcore/files/qtcore-5.7.1-qsfpm-1.patch | 252 +++++++++++++++++++++++++
 dev-qt/qtcore/files/qtcore-5.7.1-qsfpm-2.patch | 195 +++++++++++++++++++
 dev-qt/qtcore/qtcore-5.7.1-r3.ebuild           |  49 +++++
 5 files changed, 652 insertions(+)

diff --git a/dev-qt/qtcore/Manifest b/dev-qt/qtcore/Manifest
index 060c8e8..91e7a19 100644
--- a/dev-qt/qtcore/Manifest
+++ b/dev-qt/qtcore/Manifest
@@ -5,6 +5,9 @@ AUX qtcore-4.8.6-moc-boost-1.60.patch 884 SHA256 cf7417eb14641c0e4f65148f67cab2a
 AUX qtcore-4.8.7-fix-socklent-for-musl.patch 3982 SHA256 2d3065b3a372ae03a58ee76a4a24e676abc36a16f5c564b4b25c537d2520700d SHA512 d578fa49270ae8d18ff4de3a15b6f4c485503c1de61e9732e6e55d0bd3db5a0c2e68d37327e500b71a85efe05b187f435d2e4c62f23481c73a9d593803ca345c WHIRLPOOL e95016f372dc7cfff32609b838774a339320073fde9c90aa92b0ee8003bbf740a545cb500518bdd611553016bc8d9f21ea060b97742478105474561d6f3ae3d4
 AUX qtcore-5.5.1-musl-iconv.patch 672 SHA256 fcf5db5f11197079725bbd2ce3ef2b6e53db0ed0b73514a11c831605f7ae0226 SHA512 ee32f08044f0f247e901209ef8e72868bf856cf7b4a490ae05d621eba931b9b37d088dd90700cc83929b5331a7452e5daa046b145076a9e7499180919560e4ed WHIRLPOOL e1d6496703ede9db343df8afdef1276cbbd4eabf9cc5929c26cb267b01fd801bdac8847de8040a57fc3cb9533f8ab308f0176bb5389640ac9b73ad0677c5c107
 AUX qtcore-5.6.2-plugins.patch 3264 SHA256 2e0e863830f457d597e608815e92c25e4e0924a7c13c80649547e8a9be6bb420 SHA512 0d50ba6cd94fc29158931e2e09ec21c48780ecfaa75443efd842cce05cc3030f81a02385714b42d5cede3b0cbf8efc24d3c660ac4438cdd428a24bf8a624bb2d WHIRLPOOL 9ea062360162c636f43d7b490a3ee3931496b05001f9f0c99d588494d344f0a7a9d0e989b5695e468ec754e7bc789b2c2961db221701d8adf984efd691ee2a92
+AUX qtcore-5.7.1-qipm.patch 5915 SHA256 a5fb3bee98d797ac5e34bec02bcc1b5b0834fa1092fa6d1e1ea3d490975ae42f SHA512 807c030c2059cddcd159cb537ba2e4be68d6f612f45e1e7b844fc045f661739aea7bc35743735cee364d692d51774e17edced1aac8d444abaa4e4435117a5b3d WHIRLPOOL e13e1a24b750fe7729b1d86214491358937344b7a39c6c2941d372f5ce9077ecc1c320a0be2e5a9c772e1b01d786e55176cdad252c317bc62215c9c7acfe0d6b
+AUX qtcore-5.7.1-qsfpm-1.patch 8922 SHA256 3376b4564d793e0bf3770a8ebcc474a03e7aa49a8a578c136bbcb1fa6e9e136a SHA512 3854fffa1181cebe4683c54d5e774301a8710bf784dcc18367d04d193a7ce76fc6f634096b6986af41c3f5e4432b702873181a8900fd18e7617ea472d23d6d92 WHIRLPOOL 0ae27f2596e8601a4717bf76d06a2c452f4a0f087355766e7ca9483c8959ddd2c0765a6154ee1dde612347fb69ddc28581121c64cfa6f97a3067b1112bdb86c3
+AUX qtcore-5.7.1-qsfpm-2.patch 7812 SHA256 a2bb1a42df644906cacb084e579166e8229c774e2f678b8b523215d4bbffe1e7 SHA512 38b141aa7d30011d71ed9044c69f79b56698320600a64ed3cc37e8dd9d22bb9ec2f33f8348d074552a5046c2855e948e325d5421384cb4c66c0bbd566500174d WHIRLPOOL 3e65f1413ce3b3800d694b731d74026ac5d5f08f9af20b257c2b7424ec954cb1fa28067496b028c3e66680ae88e59d8ccf8c080b049fa05f31162705db1a0898
 DIST qt-everywhere-opensource-src-4.8.6.tar.gz 241623667 SHA256 8b14dd91b52862e09b8e6a963507b74bc2580787d171feda197badfa7034032c SHA512 c2d07c3cf9d687cb9b93e337c89df3f0055bd02bc8aa5ecd55d3ffb238b31a4308aeabc3c51a4f94ac76a1b00796f047513d02e427ed93ae8dd99f836fff7692 WHIRLPOOL 473566814a77237dbdd37a47980c1085f6cf39599c4d6b0120959fe80dadf65c4eaafd5f528dd86cea8815562faa204bedfe3b766c2ca4f2d2c99efc21dbca84
 DIST qt-everywhere-opensource-src-4.8.7.tar.gz 241075567 SHA256 e2882295097e47fe089f8ac741a95fef47e0a73a3f3cdf21b56990638f626ea0 SHA512 f9f81a2e7205e1fd05c8d923dc73244f29aa33f951fa6b7c5c8193449328b37084796b9b71ad0c317e4e6fd00017c10ea5d67b1b2032551cde00548522218125 WHIRLPOOL ad8f01172f5bdb3a3a69fe7b03862c4c411bc8d95211053ad66ed1d60a3c0577d073d1075a1e0a80b25d9b2721addda55a2967e6ccf5e194cec8d08770ac5fc2
 DIST qtbase-opensource-src-5.6.1-1.tar.xz 46788436 SHA256 329678347ec5ebb404225345300a8deb1e7c991322a4c50584be550c69be7c39 SHA512 e9660bee2e0acd91c3232831e4f1a99ad30b82b8ff26850494efec89a525499b721adfb63f7ede586408489d3ebf727b842cd12eab665c58769001454e7f661d WHIRLPOOL e26cf72d9644dbcb08d1269bdaa633be2e24de813deb62a1c77e448b6578f6761769664fc95c4131c342f077c092a777af8fed62ea35e5fdb0f2576d82b3c499
@@ -15,4 +18,5 @@ EBUILD qtcore-4.8.7-r2.ebuild 2873 SHA256 31208511c2f5a6ca50e242f6c5ecd690dce27b
 EBUILD qtcore-5.6.1.ebuild 794 SHA256 1da435d29fa89f6638503bf2049697b39bbfb6e20e8243c2b84604aa51a6a450 SHA512 d36f7ca356e52cf78bdcb9f9e466a4369a6f9a09dc1daa889efe4df2d0c97c80c3aa6571bad6c002a45f9a1ada7ec0147b81967e661695423e68c75314809d5e WHIRLPOOL 8a0be06d6d1205cfad442278637cd9feaff92169a955b6d5d490f29753bdee28dc2d036b7b9955db16d502324a16956d89287b6d7f8f883cc84fb4231c0f2c3e
 EBUILD qtcore-5.6.2-r1.ebuild 828 SHA256 08ad65af7dfc460978f2df70e221f1c57e27ceaf7b2c44eb9782bd90c5825771 SHA512 0ce08466d7764f84f3d1c65d0f3020e62929d4021a83e7b8db1132a6b16458ee364bb74af1842b9f7b047afdba65c344b00bfa4d8a8c7231b078b278f42fc639 WHIRLPOOL 6fa267b5bf378de902c336b06ae2f28c79642ee8c707040dd3fdfea059e246bce634df6c469fa1dbedbef707d44b7e23900375635183496a3e2735a4fd686fee
 EBUILD qtcore-5.7.1-r2.ebuild 876 SHA256 514dc8ff131a6d30ca5380d167a85ab0d21da5af51c2c1af362b3798e93b39f2 SHA512 b19653912ef0eac500e12d1bc1916d2a2409fde5807355859c4b0fd1c28a1093db4d20d8cdde3923435a1e86a9a2d0a9551ba8465d94ae0cfdb74e32079749dc WHIRLPOOL 924ebad6c5759bc10c5fcfac0beb78322108d7a5e18c1f5c3e05308bc195eaa0c4bd67cddaf6616f0f08015a3f203c49f9ca58cd96faf4ad1ead1dc541b9900a
+EBUILD qtcore-5.7.1-r3.ebuild 945 SHA256 b3b75ec95bcd5baab735dd876db7419a649dcf7fc9ca04bfa4aad96af60d3ad2 SHA512 4d9c85f573551a9debc023f182be716f5083436ecf48fb612cb292d70de7699741f03c87ed18cd7fbbb2ed9b3dc7e9778249343f83424d5d27fbbfb211a4a1c3 WHIRLPOOL 4ec369240197ed2b72455827a808611867667a1dd03dfa1b613ce6104bd5b166238da861a32f3cc95073f319325299b5e56593a1ee69abfd657032162bf4cf22
 MISC metadata.xml 923 SHA256 22b0c054608f0f06da6d5e08acca625e153346ef3c0281dd93a89bc3f9efc7e1 SHA512 c3cc5ea943e59fd44ffded076df311a62dd5fb7ff2ab197f6118604a0e26e30f44377e0b8bb3edcddbda19ea52c0a26cf6451625dd17185c511d5d051e3ad915 WHIRLPOOL 7061ff30ae1b083e1328c0080d08631a3e9ffc1986f729f9e1ae269d7ba243345859a87cdb020a3eaabd40c78c9fcaa159adfc53a3729e87ae82bf49d7530f59

diff --git a/dev-qt/qtcore/files/qtcore-5.7.1-qipm.patch b/dev-qt/qtcore/files/qtcore-5.7.1-qipm.patch
new file mode 100644
index 0000000..abea145
--- /dev/null
+++ b/dev-qt/qtcore/files/qtcore-5.7.1-qipm.patch
@@ -0,0 +1,152 @@
+From baad82d242a4d8c1af6c87faaa7f25584183fd53 Mon Sep 17 00:00:00 2001
+From: Stephen Kelly <steveire@gmail.com>
+Date: Tue, 20 Dec 2016 00:44:12 +0000
+Subject: [PATCH] QIPM: Persist model indexes after emitting layoutChange, not
+ before
+
+Callers can persist a QModelIndex which was not persisted before in a
+slot connected to the signal, and such a persisted index must be updated
+in the course of the layoutChange.
+
+Store the indexes to persist after emitting the signal.
+
+Task-number: QTBUG-32981
+Change-Id: Ibee4c0d84817d72603a03fe5b22fdeefeac0695e
+Reviewed-by: David Faure <david.faure@kdab.com>
+---
+ src/corelib/itemmodels/qidentityproxymodel.cpp     | 18 ++---
+ .../tst_qidentityproxymodel.cpp                    | 76 ++++++++++++++++++++++
+ 2 files changed, 85 insertions(+), 9 deletions(-)
+
+diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp
+index e537793..7c30679 100644
+--- a/src/corelib/itemmodels/qidentityproxymodel.cpp
++++ b/src/corelib/itemmodels/qidentityproxymodel.cpp
+@@ -496,15 +496,6 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPe
+ {
+     Q_Q(QIdentityProxyModel);
+ 
+-    const auto proxyPersistentIndexes = q->persistentIndexList();
+-    for (const QPersistentModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
+-        proxyIndexes << proxyPersistentIndex;
+-        Q_ASSERT(proxyPersistentIndex.isValid());
+-        const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex);
+-        Q_ASSERT(srcPersistentIndex.isValid());
+-        layoutChangePersistentIndexes << srcPersistentIndex;
+-    }
+-
+     QList<QPersistentModelIndex> parents;
+     parents.reserve(sourceParents.size());
+     for (const QPersistentModelIndex &parent : sourceParents) {
+@@ -518,6 +509,15 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPe
+     }
+ 
+     q->layoutAboutToBeChanged(parents, hint);
++
++    const auto proxyPersistentIndexes = q->persistentIndexList();
++    for (const QPersistentModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
++        proxyIndexes << proxyPersistentIndex;
++        Q_ASSERT(proxyPersistentIndex.isValid());
++        const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex);
++        Q_ASSERT(srcPersistentIndex.isValid());
++        layoutChangePersistentIndexes << srcPersistentIndex;
++    }
+ }
+ 
+ void QIdentityProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
+diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+index e946f31..564b854 100644
+--- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
++++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+@@ -68,6 +68,8 @@ private slots:
+ 
+     void itemData();
+ 
++    void persistIndexOnLayoutChange();
++
+ protected:
+     void verifyIdentity(QAbstractItemModel *model, const QModelIndex &parent = QModelIndex());
+ 
+@@ -377,5 +379,79 @@ void tst_QIdentityProxyModel::itemData()
+     QCOMPARE(proxy.itemData(topIndex).value(Qt::DisplayRole).toString(), QStringLiteral("Monday_appended"));
+ }
+ 
++void dump(QAbstractItemModel* model, QString const& indent = " - ", QModelIndex const& parent = {})
++{
++    for (auto row = 0; row < model->rowCount(parent); ++row)
++    {
++        auto idx = model->index(row, 0, parent);
++        qDebug() << (indent + idx.data().toString());
++        dump(model, indent + "- ", idx);
++    }
++}
++
++void tst_QIdentityProxyModel::persistIndexOnLayoutChange()
++{
++    DynamicTreeModel model;
++
++    QList<int> ancestors;
++    for (auto i = 0; i < 3; ++i)
++    {
++        Q_UNUSED(i);
++        ModelInsertCommand insertCommand(&model);
++        insertCommand.setAncestorRowNumbers(ancestors);
++        insertCommand.setStartRow(0);
++        insertCommand.setEndRow(0);
++        insertCommand.doCommand();
++        ancestors.push_back(0);
++    }
++    ModelInsertCommand insertCommand(&model);
++    insertCommand.setAncestorRowNumbers(ancestors);
++    insertCommand.setStartRow(0);
++    insertCommand.setEndRow(1);
++    insertCommand.doCommand();
++
++    // dump(&model);
++    // " - 1"
++    // " - - 2"
++    // " - - - 3"
++    // " - - - - 4"
++    // " - - - - 5"
++
++    QIdentityProxyModel proxy;
++    proxy.setSourceModel(&model);
++
++    QPersistentModelIndex persistentIndex;
++
++    QPersistentModelIndex sourcePersistentIndex = model.match(model.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
++
++    QCOMPARE(sourcePersistentIndex.data().toString(), QStringLiteral("5"));
++
++    bool gotLayoutAboutToBeChanged = false;
++    bool gotLayoutChanged = false;
++
++    QObject::connect(&proxy, &QAbstractItemModel::layoutAboutToBeChanged, &proxy, [&proxy, &persistentIndex, &gotLayoutAboutToBeChanged]
++    {
++        gotLayoutAboutToBeChanged = true;
++        persistentIndex = proxy.match(proxy.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
++    });
++
++    QObject::connect(&proxy, &QAbstractItemModel::layoutChanged, &proxy, [&proxy, &persistentIndex, &sourcePersistentIndex, &gotLayoutChanged]
++    {
++        gotLayoutChanged = true;
++        QCOMPARE(QModelIndex(persistentIndex), proxy.mapFromSource(sourcePersistentIndex));
++    });
++
++    ModelChangeChildrenLayoutsCommand layoutChangeCommand(&model, 0);
++
++    layoutChangeCommand.setAncestorRowNumbers(QList<int>{0, 0, 0});
++    layoutChangeCommand.setSecondAncestorRowNumbers(QList<int>{0, 0});
++
++    layoutChangeCommand.doCommand();
++
++    QVERIFY(gotLayoutAboutToBeChanged);
++    QVERIFY(gotLayoutChanged);
++    QVERIFY(persistentIndex.isValid());
++}
++
+ QTEST_MAIN(tst_QIdentityProxyModel)
+ #include "tst_qidentityproxymodel.moc"
+-- 
+2.7.4
+

diff --git a/dev-qt/qtcore/files/qtcore-5.7.1-qsfpm-1.patch b/dev-qt/qtcore/files/qtcore-5.7.1-qsfpm-1.patch
new file mode 100644
index 0000000..9edbe18
--- /dev/null
+++ b/dev-qt/qtcore/files/qtcore-5.7.1-qsfpm-1.patch
@@ -0,0 +1,252 @@
+From 3bd0fd8f97e7a33a874929a383a42e6c710bfff3 Mon Sep 17 00:00:00 2001
+From: Stephen Kelly <steveire@gmail.com>
+Date: Sat, 17 Dec 2016 06:20:06 +0000
+Subject: [PATCH] QSFPM: Fix handling of source model layout change
+
+In sourceLayoutAboutToBeChanged the source model update is ignored if
+the affected parents are filtered out anyway.  The same logic is
+attempted in the sourceLayoutChanged slot, but there the early-return
+logic is applied too late - the mapping is cleared before performing the
+early-return.  Because pointers into the mapping are used in the
+internalPointer of QModelIndexes in this class, persistent indexes used
+later will segfault when attempting to dereference it.
+
+Additionally, if a parent becomes invalid as a result of the
+layoutChange, it would be filtered out by the condition in the loop,
+resulting in a different result in the comparison of emptiness of the
+parents container.
+
+Fix that by persisting the parent's container, and performing the test
+for early-return before clearing the mapping.
+
+Task-number: QTBUG-47711
+Task-number: QTBUG-32981
+Change-Id: If45e8a1c97d39454160f52041bc9ae7e337dce97
+Reviewed-by: David Faure <david.faure@kdab.com>
+---
+ src/corelib/itemmodels/qsortfilterproxymodel.cpp   |  31 ++---
+ .../tst_qsortfilterproxymodel.cpp                  | 126 +++++++++++++++++++++
+ 2 files changed, 137 insertions(+), 20 deletions(-)
+
+diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+index b0ddfa8..3331521 100644
+--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
++++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+@@ -171,6 +171,7 @@ public:
+     QRowsRemoval itemsBeingRemoved;
+ 
+     QModelIndexPairList saved_persistent_indexes;
++    QList<QPersistentModelIndex> saved_layoutChange_parents;
+ 
+     QHash<QModelIndex, Mapping *>::const_iterator create_mapping(
+         const QModelIndex &source_parent) const;
+@@ -1331,23 +1332,23 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<Q
+     Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
+     saved_persistent_indexes.clear();
+ 
+-    QList<QPersistentModelIndex> parents;
++    saved_layoutChange_parents.clear();
+     for (const QPersistentModelIndex &parent : sourceParents) {
+         if (!parent.isValid()) {
+-            parents << QPersistentModelIndex();
++            saved_layoutChange_parents << QPersistentModelIndex();
+             continue;
+         }
+         const QModelIndex mappedParent = q->mapFromSource(parent);
+         // Might be filtered out.
+         if (mappedParent.isValid())
+-            parents << mappedParent;
++            saved_layoutChange_parents << mappedParent;
+     }
+ 
+     // All parents filtered out.
+-    if (!sourceParents.isEmpty() && parents.isEmpty())
++    if (!sourceParents.isEmpty() && saved_layoutChange_parents.isEmpty())
+         return;
+ 
+-    emit q->layoutAboutToBeChanged(parents);
++    emit q->layoutAboutToBeChanged(saved_layoutChange_parents);
+     if (persistent.indexes.isEmpty())
+         return;
+ 
+@@ -1359,6 +1360,9 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
+     Q_Q(QSortFilterProxyModel);
+     Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
+ 
++    if (!sourceParents.isEmpty() && saved_layoutChange_parents.isEmpty())
++        return;
++
+     // Optimize: We only actually have to clear the mapping related to the contents of
+     // sourceParents, not everything.
+     qDeleteAll(source_index_mapping);
+@@ -1373,21 +1377,8 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
+         source_index_mapping.clear();
+     }
+ 
+-    QList<QPersistentModelIndex> parents;
+-    for (const QPersistentModelIndex &parent : sourceParents) {
+-        if (!parent.isValid()) {
+-            parents << QPersistentModelIndex();
+-            continue;
+-        }
+-        const QModelIndex mappedParent = q->mapFromSource(parent);
+-        if (mappedParent.isValid())
+-            parents << mappedParent;
+-    }
+-
+-    if (!sourceParents.isEmpty() && parents.isEmpty())
+-        return;
+-
+-    emit q->layoutChanged(parents);
++    emit q->layoutChanged(saved_layoutChange_parents);
++    saved_layoutChange_parents.clear();
+ }
+ 
+ void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted(
+diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+index 38e3c68..6b98d9f 100644
+--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
++++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+@@ -145,6 +145,8 @@ private slots:
+     void canDropMimeData();
+     void filterHint();
+ 
++    void sourceLayoutChangeLeavesValidPersistentIndexes();
++
+ protected:
+     void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
+     void checkHierarchy(const QStringList &data, const QAbstractItemModel *model);
+@@ -4181,5 +4183,129 @@ void tst_QSortFilterProxyModel::filterHint()
+              QAbstractItemModel::NoLayoutChangeHint);
+ }
+ 
++/**
++
++  Creates a model where each item has one child, to a set depth,
++  and the last item has no children.  For a model created with
++  setDepth(4):
++
++    - 1
++    - - 2
++    - - - 3
++    - - - - 4
++*/
++class StepTreeModel : public QAbstractItemModel
++{
++    Q_OBJECT
++public:
++    StepTreeModel(QObject * parent = 0)
++        : QAbstractItemModel(parent), m_depth(0) {}
++
++    int columnCount(const QModelIndex& = QModelIndex()) const override { return 1; }
++
++    int rowCount(const QModelIndex& parent = QModelIndex()) const override
++    {
++        quintptr parentId = (parent.isValid()) ? parent.internalId() : 0;
++        return (parentId < m_depth) ? 1 : 0;
++    }
++
++    QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override
++    {
++        if (role != Qt::DisplayRole)
++            return QVariant();
++
++        return QString::number(index.internalId());
++    }
++
++    QModelIndex index(int, int, const QModelIndex& parent = QModelIndex()) const override
++    {
++        quintptr parentId = (parent.isValid()) ? parent.internalId() : 0;
++        if (parentId >= m_depth)
++            return QModelIndex();
++
++        return createIndex(0, 0, parentId + 1);
++    }
++
++    QModelIndex parent(const QModelIndex& index) const override
++    {
++        if (index.internalId() == 0)
++            return QModelIndex();
++
++        return createIndex(0, 0, index.internalId() - 1);
++    }
++
++    void setDepth(quintptr depth)
++    {
++        int parentIdWithLayoutChange = (m_depth < depth) ? m_depth : depth;
++
++        QList<QPersistentModelIndex> parentsOfLayoutChange;
++        parentsOfLayoutChange.push_back(createIndex(0, 0, parentIdWithLayoutChange));
++
++        layoutAboutToBeChanged(parentsOfLayoutChange);
++
++        auto existing = persistentIndexList();
++
++        QList<QModelIndex> updated;
++
++        for (auto idx : existing) {
++            if (indexDepth(idx) <= depth)
++                updated.push_back(idx);
++            else
++                updated.push_back({});
++        }
++
++        m_depth = depth;
++
++        changePersistentIndexList(existing, updated);
++
++        layoutChanged(parentsOfLayoutChange);
++    }
++
++private:
++    static quintptr indexDepth(QModelIndex const& index)
++    {
++        return (index.isValid()) ? 1 + indexDepth(index.parent()) : 0;
++    }
++
++private:
++    quintptr m_depth;
++};
++
++void tst_QSortFilterProxyModel::sourceLayoutChangeLeavesValidPersistentIndexes()
++{
++    StepTreeModel model;
++    Q_SET_OBJECT_NAME(model);
++    model.setDepth(4);
++
++    QSortFilterProxyModel proxy1;
++    proxy1.setSourceModel(&model);
++    Q_SET_OBJECT_NAME(proxy1);
++
++    proxy1.setFilterRegExp("1|2");
++
++    // The current state of things:
++    //  model         proxy
++    //   - 1           - 1
++    //   - - 2         - - 2
++    //   - - - 3
++    //   - - - - 4
++
++    // The setDepth call below removes '4' with a layoutChanged call.
++    // Because the proxy filters that out anyway, the proxy doesn't need
++    // to emit any signals or update persistent indexes.
++
++    QPersistentModelIndex persistentIndex = proxy1.index(0, 0, proxy1.index(0, 0));
++
++    model.setDepth(3);
++
++    // Calling parent() causes the internalPointer to be used.
++    // Before fixing QTBUG-47711, that could be a dangling pointer.
++    // The use of qDebug here makes sufficient use of the heap to
++    // cause corruption at runtime with normal use on linux (before
++    // the fix). valgrind confirms the fix.
++    qDebug() << persistentIndex.parent();
++    QVERIFY(persistentIndex.parent().isValid());
++}
++
+ QTEST_MAIN(tst_QSortFilterProxyModel)
+ #include "tst_qsortfilterproxymodel.moc"
+-- 
+2.7.4
+
+

diff --git a/dev-qt/qtcore/files/qtcore-5.7.1-qsfpm-2.patch b/dev-qt/qtcore/files/qtcore-5.7.1-qsfpm-2.patch
new file mode 100644
index 0000000..9736496
--- /dev/null
+++ b/dev-qt/qtcore/files/qtcore-5.7.1-qsfpm-2.patch
@@ -0,0 +1,195 @@
+From 0874861bcc70313c343aba5e5566ed30b69eed1c Mon Sep 17 00:00:00 2001
+From: Stephen Kelly <steveire@gmail.com>
+Date: Mon, 19 Dec 2016 21:13:57 +0000
+Subject: [PATCH] QSFPM: Remove data manipulation from move handlers
+
+Similar to the fix in the parent commit, incorrect updating of the
+internal data structures during layout changes can lead to dangling
+pointers being dereferenced later.  Moves are treated as layoutChanges
+by this proxy by forwarding to the appropriate method.  However, data is
+incorrectly cleared prior to that forwarding.  Remove that, and let the
+layoutChange handling take appropriate action.
+
+Change-Id: Iee951e37152328a4e6a5fb8e5385c32a2fe4c0bd
+Reviewed-by: David Faure <david.faure@kdab.com>
+---
+ src/corelib/itemmodels/qsortfilterproxymodel.cpp   | 67 ++++------------------
+ .../tst_qsortfilterproxymodel.cpp                  | 46 +++++++++++++++
+ 2 files changed, 58 insertions(+), 55 deletions(-)
+
+diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+index 3331521..226a240 100644
+--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
++++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+@@ -1418,49 +1418,27 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsRemoved(
+ void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeMoved(
+     const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
+ {
+-    Q_Q(QSortFilterProxyModel);
+     // Because rows which are contiguous in the source model might not be contiguous
+     // in the proxy due to sorting, the best thing we can do here is be specific about what
+     // parents are having their children changed.
+     // Optimize: Emit move signals if the proxy is not sorted. Will need to account for rows
+     // being filtered out though.
+ 
+-    saved_persistent_indexes.clear();
+-
+     QList<QPersistentModelIndex> parents;
+-    parents << q->mapFromSource(sourceParent);
++    parents << sourceParent;
+     if (sourceParent != destParent)
+-      parents << q->mapFromSource(destParent);
+-    emit q->layoutAboutToBeChanged(parents);
+-    if (persistent.indexes.isEmpty())
+-        return;
+-    saved_persistent_indexes = store_persistent_indexes();
++        parents << destParent;
++    _q_sourceLayoutAboutToBeChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
+ }
+ 
+ void QSortFilterProxyModelPrivate::_q_sourceRowsMoved(
+     const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
+ {
+-    Q_Q(QSortFilterProxyModel);
+-
+-    // Optimize: We only need to clear and update the persistent indexes which are children of
+-    // sourceParent or destParent
+-    qDeleteAll(source_index_mapping);
+-    source_index_mapping.clear();
+-
+-    update_persistent_indexes(saved_persistent_indexes);
+-    saved_persistent_indexes.clear();
+-
+-    if (dynamic_sortfilter && update_source_sort_column()) {
+-        //update_source_sort_column might have created wrong mapping so we have to clear it again
+-        qDeleteAll(source_index_mapping);
+-        source_index_mapping.clear();
+-    }
+-
+     QList<QPersistentModelIndex> parents;
+-    parents << q->mapFromSource(sourceParent);
++    parents << sourceParent;
+     if (sourceParent != destParent)
+-      parents << q->mapFromSource(destParent);
+-    emit q->layoutChanged(parents);
++        parents << destParent;
++    _q_sourceLayoutChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
+ }
+ 
+ void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(
+@@ -1522,42 +1500,21 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved(
+ void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(
+     const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
+ {
+-    Q_Q(QSortFilterProxyModel);
+-
+-    saved_persistent_indexes.clear();
+-
+     QList<QPersistentModelIndex> parents;
+-    parents << q->mapFromSource(sourceParent);
++    parents << sourceParent;
+     if (sourceParent != destParent)
+-      parents << q->mapFromSource(destParent);
+-    emit q->layoutAboutToBeChanged(parents);
+-
+-    if (persistent.indexes.isEmpty())
+-        return;
+-    saved_persistent_indexes = store_persistent_indexes();
++        parents << destParent;
++    _q_sourceLayoutAboutToBeChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
+ }
+ 
+ void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved(
+     const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
+ {
+-    Q_Q(QSortFilterProxyModel);
+-
+-    qDeleteAll(source_index_mapping);
+-    source_index_mapping.clear();
+-
+-    update_persistent_indexes(saved_persistent_indexes);
+-    saved_persistent_indexes.clear();
+-
+-    if (dynamic_sortfilter && update_source_sort_column()) {
+-        qDeleteAll(source_index_mapping);
+-        source_index_mapping.clear();
+-    }
+-
+     QList<QPersistentModelIndex> parents;
+-    parents << q->mapFromSource(sourceParent);
++    parents << sourceParent;
+     if (sourceParent != destParent)
+-      parents << q->mapFromSource(destParent);
+-    emit q->layoutChanged(parents);
++        parents << destParent;
++    _q_sourceLayoutChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
+ }
+ 
+ /*!
+diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+index 6b98d9f..7b6c470 100644
+--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
++++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+@@ -146,6 +146,7 @@ private slots:
+     void filterHint();
+ 
+     void sourceLayoutChangeLeavesValidPersistentIndexes();
++    void rowMoveLeavesValidPersistentIndexes();
+ 
+ protected:
+     void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
+@@ -4307,5 +4308,50 @@ void tst_QSortFilterProxyModel::sourceLayoutChangeLeavesValidPersistentIndexes()
+     QVERIFY(persistentIndex.parent().isValid());
+ }
+ 
++void tst_QSortFilterProxyModel::rowMoveLeavesValidPersistentIndexes()
++{
++    DynamicTreeModel model;
++    Q_SET_OBJECT_NAME(model);
++
++    QList<int> ancestors;
++    for (auto i = 0; i < 5; ++i)
++    {
++        Q_UNUSED(i);
++        ModelInsertCommand insertCommand(&model);
++        insertCommand.setAncestorRowNumbers(ancestors);
++        insertCommand.setStartRow(0);
++        insertCommand.setEndRow(0);
++        insertCommand.doCommand();
++        ancestors.push_back(0);
++    }
++
++    QSortFilterProxyModel proxy1;
++    proxy1.setSourceModel(&model);
++    Q_SET_OBJECT_NAME(proxy1);
++
++    proxy1.setFilterRegExp("1|2");
++
++    auto item5 = model.match(model.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
++    auto item3 = model.match(model.index(0, 0), Qt::DisplayRole, "3", 1, Qt::MatchRecursive).first();
++
++    Q_ASSERT(item5.isValid());
++    Q_ASSERT(item3.isValid());
++
++    QPersistentModelIndex persistentIndex = proxy1.match(proxy1.index(0, 0), Qt::DisplayRole, "2", 1, Qt::MatchRecursive).first();
++
++    ModelMoveCommand moveCommand(&model, 0);
++    moveCommand.setAncestorRowNumbers(QList<int>{0, 0, 0, 0});
++    moveCommand.setStartRow(0);
++    moveCommand.setEndRow(0);
++    moveCommand.setDestRow(0);
++    moveCommand.setDestAncestors(QList<int>{0, 0, 0});
++    moveCommand.doCommand();
++
++    // Calling parent() causes the internalPointer to be used.
++    // Before fixing QTBUG-47711 (moveRows case), that could be
++    // a dangling pointer.
++    QVERIFY(persistentIndex.parent().isValid());
++}
++
+ QTEST_MAIN(tst_QSortFilterProxyModel)
+ #include "tst_qsortfilterproxymodel.moc"
+-- 
+2.7.4
+
+

diff --git a/dev-qt/qtcore/qtcore-5.7.1-r3.ebuild b/dev-qt/qtcore/qtcore-5.7.1-r3.ebuild
new file mode 100644
index 0000000..8d49771
--- /dev/null
+++ b/dev-qt/qtcore/qtcore-5.7.1-r3.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+QT5_MODULE="qtbase"
+inherit qt5-build
+
+DESCRIPTION="Cross-platform application development framework"
+
+if [[ ${QT5_BUILD_TYPE} == release ]]; then
+	KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86"
+fi
+
+IUSE="icu systemd"
+
+DEPEND="
+	dev-libs/double-conversion:=
+	dev-libs/glib:2
+	>=dev-libs/libpcre-8.38[pcre16,unicode]
+	>=sys-libs/zlib-1.2.5
+	virtual/libiconv
+	icu? ( dev-libs/icu:= )
+	systemd? ( sys-apps/systemd:= )
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-5.6.2-plugins.patch
+	"${FILESDIR}"/${P}-qipm.patch
+	"${FILESDIR}"/${P}-qsfpm-{1,2}.patch
+	"${FILESDIR}/${PN}-5.5.1-musl-iconv.patch"
+)
+
+QT5_TARGET_SUBDIRS=(
+	src/tools/bootstrap
+	src/tools/moc
+	src/tools/rcc
+	src/corelib
+	src/tools/qlalr
+	doc
+)
+
+src_configure() {
+	local myconf=(
+		$(qt_use icu)
+		$(qt_use systemd journald)
+	)
+	qt5-build_src_configure
+}


             reply	other threads:[~2017-04-24  3:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24  3:02 Aric Belsito [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-14 16:22 [gentoo-commits] proj/musl:master commit in: dev-qt/qtcore/files/, dev-qt/qtcore/ Aric Belsito
2017-12-10 20:24 Anthony G. Basile
2017-11-29  6:33 Aric Belsito
2016-11-09 19:49 Aric Belsito
2015-07-04 22:45 Anthony G. Basile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1493002902.d9e34eb40544eba511b2cf9da866edf8cb4c27d5.lluixhi@gentoo \
    --to=lluixhi@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox