[arch-commits] Commit in qt/trunk (3 files)

Andrea Scarpino andrea at archlinux.org
Sun Nov 4 08:05:33 UTC 2012


    Date: Sunday, November 4, 2012 @ 03:05:32
  Author: andrea
Revision: 170183

Fix crash in QtScript (fixes KDevelop frequent crash); Add icu as optdepends (FS#31314); Fix crash when ivalidating QSortFilterProxyModel (FS#31716)

Added:
  qt/trunk/fix-qtscript-crash.patch
  qt/trunk/qsortfilterproxymodel.patch
Modified:
  qt/trunk/PKGBUILD

-----------------------------+
 PKGBUILD                    |   27 +++++---
 fix-qtscript-crash.patch    |   34 ++++++++++
 qsortfilterproxymodel.patch |  141 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 194 insertions(+), 8 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2012-11-04 07:59:41 UTC (rev 170182)
+++ PKGBUILD	2012-11-04 08:05:32 UTC (rev 170183)
@@ -5,7 +5,7 @@
 pkgbase=qt
 pkgname=('qt' 'qt-private-headers')
 pkgver=4.8.3
-pkgrel=4
+pkgrel=5
 arch=('i686' 'x86_64')
 url='http://qt-project.org/'
 license=('GPL3' 'LGPL')
@@ -21,7 +21,9 @@
         'improve-cups-support.patch'
         'fix-crash-in-assistant.patch'
         'undo-fix-jit-crash-on-x86_64.patch'
-        'disable-ssl-compression.patch')
+        'disable-ssl-compression.patch'
+        'fix-qtscript-crash.patch'
+        'qsortfilterproxymodel.patch')
 md5sums=('a663b6c875f8d7caa8ac9c30e4a4ec3b'
          'fc211414130ab2764132e7370f8e5caa'
          '85179f5e0437514f8639957e1d8baf62'
@@ -30,10 +32,12 @@
          'c439c7731c25387352d8453ca7574971'
          '57590084078b6379f0501f7728b02ae2'
          '094e5a4e30e52423c77daa4a9c782df5'
-         '94e9e433342018bf35e8d6d968b7432c')
+         '94e9e433342018bf35e8d6d968b7432c'
+         '71579422635e9343665de1c1ba5a3f91'
+         'd288b87afa4a3c81e54a3aea8f42e3b0')
 
 build() {
-  cd "${srcdir}"/${_pkgfqn}
+  cd ${_pkgfqn}
 
   # (FS#28381) (KDEBUG#180051)
   patch -p1 -i "${srcdir}"/improve-cups-support.patch
@@ -46,7 +50,13 @@
 
   # Security fix
   patch -p1 -i "${srcdir}"/disable-ssl-compression.patch
+
+  # QTBUG#27322
+  patch -p1 -i "${srcdir}"/fix-qtscript-crash.patch
   
+  # QTBUG#27122
+  patch -p1 -i "${srcdir}"/qsortfilterproxymodel.patch
+  
   export QT4DIR="${srcdir}"/${_pkgfqn}
   export LD_LIBRARY_PATH=${QT4DIR}/lib:${LD_LIBRARY_PATH}
 
@@ -94,10 +104,11 @@
                 'libfbclient: Firebird/iBase driver'
                 'libxinerama: Xinerama support'
                 'libxcursor: Xcursor support'
-                'libxfixes: Xfixes support')
+                'libxfixes: Xfixes support'
+                'icu: Unicode support')
     install='qt.install'
 
-    cd "${srcdir}"/${_pkgfqn}
+    cd ${_pkgfqn}
     make INSTALL_ROOT="${pkgdir}" install
 
     # install missing icons and desktop files
@@ -137,11 +148,11 @@
     install -d "${pkgdir}"/usr/src/{corelib,declarative,gui,script}
     
     for i in QtCore QtDeclarative QtGui QtScript; do
-      cp -r "${srcdir}"/${_pkgfqn}/include/${i}/private/ \
+      cp -r ${_pkgfqn}/include/${i}/private/ \
         "${pkgdir}"/usr/include/${i}/
     done
 
     for i in corelib declarative gui script; do
-      cp -r "${srcdir}"/${_pkgfqn}/src/${i} "${pkgdir}"/usr/src/
+      cp -r ${_pkgfqn}/src/${i} "${pkgdir}"/usr/src/
     done
 }

Added: fix-qtscript-crash.patch
===================================================================
--- fix-qtscript-crash.patch	                        (rev 0)
+++ fix-qtscript-crash.patch	2012-11-04 08:05:32 UTC (rev 170183)
@@ -0,0 +1,34 @@
+From e6b7178bc2e62a37b4737695bced1b46bced9215 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= <jedrzej.nowacki at digia.com>
+Date: Mon, 22 Oct 2012 15:17:19 +0200
+Subject: [PATCH] Fix mmap usage.
+
+Add missing MAP_NORESERVE and fix error checking.
+
+Special thanks to Olivier JG for debugging the issue.
+
+Task-number: QTBUG-27322
+Change-Id: Ia9f4aa80415f0127318714912b524131a5b0f18a
+Reviewed-by: Simon Hausmann <simon.hausmann at digia.com>
+---
+ .../JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp             | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
+index 16d0fb1..e1237e4 100644
+--- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
+@@ -305,8 +305,8 @@ public:
+         randomLocation += (1 << 24);
+         randomLocation <<= 21;
+ #endif
+-        m_base = mmap(reinterpret_cast<void*>(randomLocation), m_totalHeapSize, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);
+-        if (!m_base)
++        m_base = mmap(reinterpret_cast<void*>(randomLocation), m_totalHeapSize, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON | MAP_NORESERVE, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);
++        if (m_base == MAP_FAILED)
+             CRASH();
+ 
+         // For simplicity, we keep all memory in m_freeList in a 'released' state.
+-- 
+1.8.0
+

Added: qsortfilterproxymodel.patch
===================================================================
--- qsortfilterproxymodel.patch	                        (rev 0)
+++ qsortfilterproxymodel.patch	2012-11-04 08:05:32 UTC (rev 170183)
@@ -0,0 +1,141 @@
+From 989e6c5ee6f3e38b24632ec5caf49c5b03d17aed Mon Sep 17 00:00:00 2001
+From: Stephen Kelly <stephen.kelly at kdab.com>
+Date: Fri, 14 Sep 2012 15:42:34 +0200
+Subject: [PATCH] Fix crash when invalidating a QSortFilterProxyModel
+
+Backport of d7a15fbfd93fb566c7793596ea50d8786b9eb654 from qtbase.
+
+Task-number: QTBUG-27122
+Change-Id: I0b1eda292fd9648e6f08629f7a069b66bb8b59e8
+Reviewed-by: Olivier Goffart <ogoffart at woboq.com>
+---
+ src/gui/itemviews/qsortfilterproxymodel.cpp        | 28 +++++++---
+ .../tst_qsortfilterproxymodel.cpp                  | 61 ++++++++++++++++++++++
+ 2 files changed, 83 insertions(+), 6 deletions(-)
+
+diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
+index d937b63..9fe224e 100644
+--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
++++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
+@@ -1036,18 +1036,34 @@ void QSortFilterProxyModelPrivate::filter_changed(const QModelIndex &source_pare
+     Mapping *m = it.value();
+     QSet<int> rows_removed = handle_filter_changed(m->proxy_rows, m->source_rows, source_parent, Qt::Vertical);
+     QSet<int> columns_removed = handle_filter_changed(m->proxy_columns, m->source_columns, source_parent, Qt::Horizontal);
+-    QVector<QModelIndex> mappedChildren = m->mapped_children;
+-    QVector<QModelIndex>::iterator it2 = mappedChildren.end();
+-    while (it2 != mappedChildren.begin()) {
+-        --it2;
+-        const QModelIndex source_child_index = *it2;
++
++    // We need to iterate over a copy of m->mapped_children because otherwise it may be changed by other code, invalidating
++    // the iterator it2.
++    // The m->mapped_children vector can be appended to with indexes which are no longer filtered
++    // out (in create_mapping) when this function recurses for child indexes.
++    const QVector<QModelIndex> mappedChildren = m->mapped_children;
++    QVector<int> indexesToRemove;
++    for (int i = 0; i < mappedChildren.size(); ++i) {
++        const QModelIndex source_child_index = mappedChildren.at(i);
+         if (rows_removed.contains(source_child_index.row()) || columns_removed.contains(source_child_index.column())) {
+-            it2 = mappedChildren.erase(it2);
++            indexesToRemove.push_back(i);
+             remove_from_mapping(source_child_index);
+         } else {
+             filter_changed(source_child_index);
+         }
+     }
++    QVector<int>::const_iterator removeIt = indexesToRemove.constEnd();
++    const QVector<int>::const_iterator removeBegin = indexesToRemove.constBegin();
++
++    // We can't just remove these items from mappedChildren while iterating above and then
++    // do something like m->mapped_children = mappedChildren, because mapped_children might
++    // be appended to in create_mapping, and we would lose those new items.
++    // Because they are always appended in create_mapping, we can still remove them by
++    // position here.
++    while (removeIt != removeBegin) {
++        --removeIt;
++        m->mapped_children.remove(*removeIt);
++    }
+ }
+ 
+ /*!
+diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+index 8ab5098..d0887fc 100644
+--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
++++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+@@ -152,6 +152,7 @@ private slots:
+     void testResetInternalData();
+     void filteredColumns();
+     void hierarchyFilterInvalidation();
++    void simpleFilterInvalidation();
+ 
+ protected:
+     void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
+@@ -3475,5 +3476,65 @@ void tst_QSortFilterProxyModel::hierarchyFilterInvalidation()
+     proxy.setMode(true);
+ }
+ 
++
++class FilterProxy2 : public QSortFilterProxyModel
++{
++    Q_OBJECT
++public:
++    FilterProxy2(QObject *parent = 0)
++      : QSortFilterProxyModel(parent),
++        mode(false)
++    {
++
++    }
++
++public slots:
++    void setMode(bool on)
++    {
++        mode = on;
++        invalidateFilter();
++    }
++
++protected:
++    virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
++    {
++        if (source_parent.isValid()) {
++            return true;
++        } else {
++            if (0 == source_row) {
++                return true;
++            } else {
++                return !mode;
++            }
++        }
++    }
++
++private:
++    bool mode;
++};
++
++void tst_QSortFilterProxyModel::simpleFilterInvalidation()
++{
++    QStandardItemModel model;
++    for (int i = 0; i < 2; ++i) {
++        QStandardItem *child = new QStandardItem(QString("Row %1").arg(i));
++        child->appendRow(new QStandardItem("child"));
++        model.appendRow(child);
++    }
++
++    FilterProxy2 proxy;
++    proxy.setSourceModel(&model);
++
++    QTreeView view;
++    view.setModel(&proxy);
++
++    view.show();
++    QTest::qWaitForWindowShown(&view);
++
++    proxy.setMode(true);
++    model.insertRow(0, new QStandardItem("extra"));
++}
++
++
+ QTEST_MAIN(tst_QSortFilterProxyModel)
+ #include "tst_qsortfilterproxymodel.moc"
+-- 
+1.8.0
+




More information about the arch-commits mailing list