diff options
author | Felix Schindler | 2017-07-28 12:10:05 +0200 |
---|---|---|
committer | Felix Schindler | 2017-08-01 08:27:36 +0200 |
commit | 651a6320cf1c57464007122d9ee624493aabb887 (patch) | |
tree | af8e1bac56ccb1cc919fb79a3582b639c07d33cc | |
download | aur-651a6320cf1c57464007122d9ee624493aabb887.tar.gz |
[5.8.0-1]
-rw-r--r-- | .SRCINFO | 98 | ||||
-rw-r--r-- | PKGBUILD | 220 | ||||
-rw-r--r-- | assistant.desktop | 8 | ||||
-rw-r--r-- | designer.desktop | 10 | ||||
-rw-r--r-- | linguist.desktop | 9 | ||||
-rw-r--r-- | plasma-crash-1.patch | 248 | ||||
-rw-r--r-- | plasma-crash-2.patch | 191 | ||||
-rw-r--r-- | plasma-crash-3.patch | 149 | ||||
-rw-r--r-- | qdbusviewer.desktop | 9 | ||||
-rw-r--r-- | qt5-base-journald.patch | 190 | ||||
-rw-r--r-- | qt5-webengine-nss.patch | 31 | ||||
-rw-r--r-- | qt5-webkit-icu59.patch | 73 | ||||
-rw-r--r-- | qt58.PATH | 4 | ||||
-rw-r--r-- | qtbug-53375.patch | 113 | ||||
-rw-r--r-- | qtwebengine-5.7.0-icu58.patch | 105 | ||||
-rw-r--r-- | revert-5b807802.patch | 542 |
16 files changed, 2000 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..7e50a990344c --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,98 @@ +# Generated by mksrcinfo v8 +# Tue Aug 1 08:26:46 CEST 2017 +pkgbase = qt58 + pkgdesc = A cross-platform application and UI framework (5.8.x) + pkgver = 5.8.0 + pkgrel = 1 + url = http://qt-project.org/ + arch = i686 + arch = x86_64 + license = GPL3 + license = LGPL3 + license = FDL + license = custom + makedepends = libfbclient + makedepends = libmariadbclient + makedepends = sqlite + makedepends = unixodbc + makedepends = postgresql-libs + makedepends = alsa-lib + makedepends = gst-plugins-base-libs + makedepends = gtk3 + makedepends = cups + makedepends = freetds + makedepends = flite + makedepends = speech-dispatcher + depends = libjpeg-turbo + depends = xcb-util-keysyms + depends = xcb-util-renderutil + depends = libgl + depends = fontconfig + depends = xcb-util-wm + depends = libxrender + depends = libxi + depends = sqlite + depends = xcb-util-image + depends = icu + depends = assimp + depends = bluez-libs + depends = sdl2 + depends = libpulse + depends = openal + depends = hicolor-icon-theme + depends = double-conversion + depends = tslib + depends = libinput + depends = libsm + depends = libxkbcommon-x11 + depends = libproxy + depends = libcups + depends = openssl-1.0 + optdepends = postgresql-libs: PostgreSQL driver + optdepends = libmariadbclient: MariaDB driver + optdepends = unixodbc: ODBC driver + optdepends = libfbclient: Firebird/iBase driver + optdepends = freetds: MS SQL driver + optdepends = flite: flite TTS backend + optdepends = speech-dispatcher: speech-dispatcher TTS backend + optdepends = gst-plugins-bad: camera support + optdepends = gtk3: GTK platform plugin + source = http://download.qt.io/archive/qt/5.8/5.8.0/single/qt-everywhere-opensource-src-5.8.0.tar.xz + source = qtbug-53375.patch + source = qt5-base-journald.patch::https://github.com/qt/qtbase/commit/0c8f3229.patch + source = plasma-crash-1.patch::https://github.com/qt/qtbase/commit/3bd0fd8f.patch + source = plasma-crash-2.patch::https://github.com/qt/qtbase/commit/0874861b.patch + source = plasma-crash-3.patch::https://github.com/qt/qtbase/commit/baad82d2.patch + source = qt58.PATH + source = revert-5b807802.patch + source = qt5-webengine-nss.patch + source = qtwebengine-5.7.0-icu58.patch + source = qtbug-58488.patch::https://github.com/qt/qtwebengine/commit/7e7dd262.patch + source = qtbug-58381.patch::https://github.com/qt/qtwebengine/commit/8e147ed3.patch + source = qtbug-58515.patch::https://github.com/qt/qtwebengine/commit/a6c6665d.patch + source = qtbug-58673.patch::https://github.com/qt/qtwebengine/commit/90501711.patch + source = qtbug-58362.patch::https://github.com/qt/qtwebengine/commit/31374ba9.patch + source = qtbug-57778.patch::https://github.com/qt/qtwebengine/commit/5c2cbfcc.patch + source = qt5-webkit-icu59.patch + source = qtbug-58811.patch::https://github.com/qt/qtdeclarative/commit/b078939.patch + md5sums = 66660cd3d9e1a6fed36e88adcb72e9fe + md5sums = 126477f84a61f3852b7d392f9eb31949 + md5sums = e9ab6de042b599638f506d2974598164 + md5sums = 438f85a8ecc0f8c066dc0deb5961b6fa + md5sums = 763a796776f3f8bf46cd4a0ed13d4028 + md5sums = ffacccebfc17dc5a87724d13cefe38e5 + md5sums = 86f9c05e82c1554685561962ae62263b + md5sums = 95e986e9c0ab5ebe03c85efb69ee751a + md5sums = 2a1610b34204102938a24154a52e5571 + md5sums = 9d225d1bf83ea45dbf6556d30d35fcb8 + md5sums = 0219eab606c732b2d5c0badec65bc5aa + md5sums = 9cdb9bfec2dee46b09969a6e9a018e7f + md5sums = 8898bbae4c4059963d5c31a6cabe93dd + md5sums = 700db01ba526a4b08f9e355ed9951165 + md5sums = 8762d933ea50b0147c8b10e241a24330 + md5sums = 2c04883620761476fa4e2985988e11a4 + md5sums = f6c74b0196a698cc1c5a34c695b22715 + md5sums = 8604dec4cc46c1d2139edb640f8e13bb + +pkgname = qt58 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..c41196c00e61 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,220 @@ +# Maintainer: Felix Schindler <aur at felixschindler dot net> +# Contributor: Felix Yan <felixonmars@archlinux.org> +# Contributor: Andrea Scarpino <andrea@archlinux.org> + +pkgname=qt58 +pkgver=5.8.0 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://qt-project.org/' +license=('GPL3' 'LGPL3' 'FDL' 'custom') +pkgdesc='A cross-platform application and UI framework (5.8.x)' +depends=('libjpeg-turbo' 'xcb-util-keysyms' 'xcb-util-renderutil' 'libgl' 'fontconfig' + 'xcb-util-wm' 'libxrender' 'libxi' 'sqlite' 'xcb-util-image' 'icu' 'assimp' + 'bluez-libs' 'sdl2' 'libpulse' 'openal' 'hicolor-icon-theme' 'double-conversion' + 'tslib' 'libinput' 'libsm' 'libxkbcommon-x11' 'libproxy' 'libcups' 'openssl-1.0') +makedepends=('libfbclient' 'libmariadbclient' 'sqlite' 'unixodbc' 'postgresql-libs' 'alsa-lib' 'gst-plugins-base-libs' + 'gtk3' 'cups' 'freetds' 'flite' 'speech-dispatcher') +optdepends=('postgresql-libs: PostgreSQL driver' + 'libmariadbclient: MariaDB driver' + 'unixodbc: ODBC driver' + 'libfbclient: Firebird/iBase driver' + 'freetds: MS SQL driver' + 'flite: flite TTS backend' + 'speech-dispatcher: speech-dispatcher TTS backend' + 'gst-plugins-bad: camera support' + 'gtk3: GTK platform plugin') +_pkgfqn="qt-everywhere-opensource-src-${pkgver}" +source=("http://download.qt.io/archive/qt/5.8/${pkgver}/single/qt-everywhere-opensource-src-${pkgver}.tar.xz" + qtbug-53375.patch + qt5-base-journald.patch::"https://github.com/qt/qtbase/commit/0c8f3229.patch" + plasma-crash-1.patch::https://github.com/qt/qtbase/commit/3bd0fd8f.patch + plasma-crash-2.patch::https://github.com/qt/qtbase/commit/0874861b.patch + plasma-crash-3.patch::https://github.com/qt/qtbase/commit/baad82d2.patch + qt58.PATH + revert-5b807802.patch + qt5-webengine-nss.patch + qtwebengine-5.7.0-icu58.patch + qtbug-58488.patch::"https://github.com/qt/qtwebengine/commit/7e7dd262.patch" + qtbug-58381.patch::"https://github.com/qt/qtwebengine/commit/8e147ed3.patch" + qtbug-58515.patch::"https://github.com/qt/qtwebengine/commit/a6c6665d.patch" + qtbug-58673.patch::"https://github.com/qt/qtwebengine/commit/90501711.patch" + qtbug-58362.patch::"https://github.com/qt/qtwebengine/commit/31374ba9.patch" + qtbug-57778.patch::"https://github.com/qt/qtwebengine/commit/5c2cbfcc.patch" + qt5-webkit-icu59.patch + qtbug-58811.patch::"https://github.com/qt/qtdeclarative/commit/b078939.patch") +md5sums=('66660cd3d9e1a6fed36e88adcb72e9fe' + '126477f84a61f3852b7d392f9eb31949' + 'e9ab6de042b599638f506d2974598164' + '438f85a8ecc0f8c066dc0deb5961b6fa' + '763a796776f3f8bf46cd4a0ed13d4028' + 'ffacccebfc17dc5a87724d13cefe38e5' + '86f9c05e82c1554685561962ae62263b' + '95e986e9c0ab5ebe03c85efb69ee751a' + '2a1610b34204102938a24154a52e5571' + '9d225d1bf83ea45dbf6556d30d35fcb8' + '0219eab606c732b2d5c0badec65bc5aa' + '9cdb9bfec2dee46b09969a6e9a018e7f' + '8898bbae4c4059963d5c31a6cabe93dd' + '700db01ba526a4b08f9e355ed9951165' + '8762d933ea50b0147c8b10e241a24330' + '2c04883620761476fa4e2985988e11a4' + 'f6c74b0196a698cc1c5a34c695b22715' + '8604dec4cc46c1d2139edb640f8e13bb') + +prepare() { + # Fix gcc bug: https://bugreports.qt.io/browse/QTBUG-53375 + cd ${srcdir}/${_pkgfqn} + patch -p1 -i ${srcdir}/qtbug-53375.patch + + # base + ###### + cd ${srcdir}/${_pkgfqn}/qtbase + + # Build qmake using Arch {C,LD}FLAGS + # This also sets default {C,CXX,LD}FLAGS for projects built using qmake + sed -i -e "s|^\(QMAKE_CFLAGS_RELEASE.*\)|\1 ${CFLAGS}|" \ + mkspecs/common/gcc-base.conf + sed -i -e "s|^\(QMAKE_LFLAGS_RELEASE.*\)|\1 ${LDFLAGS}|" \ + mkspecs/common/g++-unix.conf + + # Use python2 for Python 2.x + find . -name '*.py' -exec sed -i \ + 's|#![ ]*/usr/bin/python$|&2|;s|#![ ]*/usr/bin/env python$|&2|' {} + + + find -name '*.pro' -o -name '*.pri' -o -name '*.prf' | xargs sed -i -e 's|python -c|python2 -c|g' -e 's|python \$|python2 \$|g' + + # Fix logging to systemd journal + patch -p1 -i ${srcdir}/qt5-base-journald.patch + + # Fix some Plasma taskbar crashes https://bugs.kde.org/show_bug.cgi?id=342763 + patch -p1 -i ${srcdir}/plasma-crash-1.patch + patch -p1 -i ${srcdir}/plasma-crash-2.patch + patch -p1 -i ${srcdir}/plasma-crash-3.patch + + # declarative + ############# + cd ${srcdir}/${_pkgfqn}/qtdeclarative + + # Fix crash on Plasma toolbox https://bugreports.qt.io/browse/QTBUG-58811 + patch -p1 -i ${srcdir}/qtbug-58811.patch + + # doc + ##### + cd ${srcdir}/${_pkgfqn} + + ln -s /usr/bin/{rcc,uic,moc} qtbase/bin/ + + # workaround c++11 detection with GCC6 + sed -e '/requires(c++11)/d' -i qtserialbus/qtserialbus.pro + + # # Hack to force using python2 + # cd "$srcdir" + # mkdir -p bin + # ln -s /usr/bin/python2 bin/python + + # wayland + ######### + cd ${srcdir}/${_pkgfqn}/qtwayland + + # Revert commit that breaks Plasma Wayland + patch -Rp1 -i ${srcdir}/revert-5b807802.patch + + # webengine + ########### + cd ${srcdir}/${_pkgfqn}/qtwebengine + + # Prevent drop-down popups form stealing focus https://bugreports.qt.io/browse/QTBUG-58488 + patch -p1 -i ${srcdir}/qtbug-58488.patch + + # Backport some focus fixes + patch -p1 -i ${srcdir}/qtbug-58381.patch + patch -p1 -i ${srcdir}/qtbug-58515.patch + patch -p1 -i ${srcdir}/qtbug-58673.patch + + # Fix IME support + patch -p1 -i ${srcdir}/qtbug-58362.patch + + # Fix incorrectly overriding new and delete + patch -p1 -i ${srcdir}/qtbug-57778.patch +} + +build() { + cd ${srcdir}/${_pkgfqn} + + # FS#38796 + [[ "${CARCH}" = "i686" ]] && SSE2="-no-sse2" + + echo "INCLUDEPATH += /usr/include/openssl-1.0" >> qtbase/src/network/network.pro + export OPENSSL_LIBS='-L/usr/lib/openssl-1.0 -lssl -lcrypto' + + PYTHON=/usr/bin/python2 ./configure -confirm-license -opensource -v \ + -prefix /opt/$pkgname \ + -plugin-sql-{psql,mysql,sqlite,odbc,ibase} \ + -system-sqlite \ + -openssl-linked \ + -nomake examples \ + -nomake tests \ + -no-rpath \ + -optimized-qmake \ + -dbus-linked \ + -system-harfbuzz \ + -journald \ + -no-use-gold-linker \ + -reduce-relocations ${SSE2} + + make + # make docs +} + +package() { + # base + # #### + cd ${srcdir}/${_pkgfqn} + + make INSTALL_ROOT="${pkgdir}" install + + install -D -m644 LGPL_EXCEPTION.txt \ + "${pkgdir}"/usr/share/licenses/${pkgname}/LGPL_EXCEPTION.txt + + # Drop QMAKE_PRL_BUILD_DIR because reference the build dir + find "${pkgdir}/opt/$pkgname/lib" -type f -name '*.prl' \ + -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \; + + # Fix wrong qmake path in pri file + sed -i "s|${srcdir}/${_pkgfqn}|/opt/${pkgname}|" \ + "${pkgdir}"/opt/$pkgname/mkspecs/modules/qt_lib_bootstrap_private.pri + + # Symlinks for backwards compatibility + for b in "${pkgdir}"/opt/$pkgname/bin/*; do + ln -s /opt/$pkgname/bin/$(basename $b) "${pkgdir}"/opt/$pkgname/bin/$(basename $b)-qt5 + done + + # install PATH file + install -m644 "${srcdir}/${pkgname}.PATH" "${pkgdir}/opt/${pkgname}.PATH" + + # xcb-private-headers + # ################### + install -d -m755 "$pkgdir"/opt/$pkgname/include/qtxcb-private + + # examples + ########## + # The various example dirs have conflicting .pro files, but + # QtCreator requires them to be in the same top-level directory. + # Matching the Qt5 installer, only the qtbase project is kept. + _base="$pkgdir"/opt/share/doc/qt/examples + mkdir -p $_base + cp ${srcdir}/${_pkgfqn}/qtbase/examples/examples.pro $_base + + _fdirs=$(find "${srcdir}/${_pkgfqn}" -maxdepth 2 -type d -name examples) + for _dir in $_fdirs; do + _mod=$(basename ${_dir%/examples}) + + if [ -e "$_dir/README" ]; then + cp $_dir/README $_dir/README.$_mod + fi + + cp -rn $_dir/* $_base + done +} + diff --git a/assistant.desktop b/assistant.desktop new file mode 100644 index 000000000000..c84bbd9f2ebc --- /dev/null +++ b/assistant.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Qt Assistant +Comment=Shows Qt documentation and examples +Exec=assistant +Icon=assistant +Terminal=false +Type=Application +Categories=Qt;Development;Documentation; diff --git a/designer.desktop b/designer.desktop new file mode 100644 index 000000000000..fc020baf84aa --- /dev/null +++ b/designer.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Qt Designer +GenericName=Interface Designer +Comment=Design GUIs for Qt applications +Exec=designer +Icon=QtProject-designer +MimeType=application/x-designer; +Terminal=false +Type=Application +Categories=Qt;Development; diff --git a/linguist.desktop b/linguist.desktop new file mode 100644 index 000000000000..aa5696bf0b06 --- /dev/null +++ b/linguist.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Qt Linguist +Comment=Add translations to Qt applications +Exec=linguist +Icon=linguist +MimeType=text/vnd.trolltech.linguist;application/x-linguist; +Terminal=false +Type=Application +Categories=Qt;Development; diff --git a/plasma-crash-1.patch b/plasma-crash-1.patch new file mode 100644 index 000000000000..90790bc05454 --- /dev/null +++ b/plasma-crash-1.patch @@ -0,0 +1,248 @@ +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 b0ddfa879d..333152138e 100644 +--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp ++++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp +@@ -171,6 +171,7 @@ class QSortFilterProxyModelPrivate : public QAbstractProxyModelPrivate + 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 38e3c6890d..6b98d9f4a3 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" diff --git a/plasma-crash-2.patch b/plasma-crash-2.patch new file mode 100644 index 000000000000..3dd1f2c44c61 --- /dev/null +++ b/plasma-crash-2.patch @@ -0,0 +1,191 @@ +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 333152138e..226a2401e1 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 6b98d9f4a3..7b6c470dc4 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" diff --git a/plasma-crash-3.patch b/plasma-crash-3.patch new file mode 100644 index 000000000000..467390a946e7 --- /dev/null +++ b/plasma-crash-3.patch @@ -0,0 +1,149 @@ +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 e537793146..7c306799d0 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 e946f3104a..564b8547b1 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" diff --git a/qdbusviewer.desktop b/qdbusviewer.desktop new file mode 100644 index 000000000000..9b8ab2a86f3e --- /dev/null +++ b/qdbusviewer.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Qt QDbusViewer +GenericName=D-Bus Debugger +Comment=Debug D-Bus applications +Exec=qdbusviewer +Icon=qdbusviewer +Terminal=false +Type=Application +Categories=Qt;Development;Debugger; diff --git a/qt5-base-journald.patch b/qt5-base-journald.patch new file mode 100644 index 000000000000..8f725aa5f251 --- /dev/null +++ b/qt5-base-journald.patch @@ -0,0 +1,190 @@ +From 0c8f3229de8ec4a8e70d4b41672074b94a45b1fe Mon Sep 17 00:00:00 2001 +From: Lars Knoll <lars.knoll@qt.io> +Date: Fri, 18 Nov 2016 12:57:53 +0100 +Subject: [PATCH] Clean up config handling of logging backends + +Turn them into proper private features, and remove setting of +defines in the pri file. + +Change-Id: Iafc11e93d4a9349bf15971dc1adac9a828ea03f6 +Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> +--- + src/corelib/configure.json | 7 +++---- + src/corelib/global/global.pri | 12 ++---------- + src/corelib/global/qconfig-bootstrapped.h | 3 +++ + src/corelib/global/qlogging.cpp | 23 ++++++++++++----------- + 4 files changed, 20 insertions(+), 25 deletions(-) + +diff --git a/src/corelib/configure.json b/src/corelib/configure.json +index 0d1954c3a8..89f824d880 100644 +--- a/src/corelib/configure.json ++++ b/src/corelib/configure.json +@@ -289,7 +289,7 @@ + "label": "journald", + "autoDetect": false, + "condition": "libs.journald", +- "output": [ "privateConfig" ] ++ "output": [ "privateFeature" ] + }, + "std-atomic64": { + "label": "64 bit atomic operations", +@@ -363,14 +363,13 @@ + "slog2": { + "label": "slog2", + "condition": "libs.slog2", +- "emitIf": "config.qnx", +- "output": [ "privateConfig" ] ++ "output": [ "privateFeature" ] + }, + "syslog": { + "label": "syslog", + "autoDetect": false, + "condition": "tests.syslog", +- "output": [ "privateConfig" ] ++ "output": [ "privateFeature" ] + }, + "threadsafe-cloexec": { + "label": "Threadsafe pipe creation", +diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri +index f74662b464..36655ca1dd 100644 +--- a/src/corelib/global/global.pri ++++ b/src/corelib/global/global.pri +@@ -47,19 +47,11 @@ if(linux*|hurd*):!cross_compile:!static:!*-armcc* { + DEFINES += ELF_INTERPRETER=\\\"$$system(LC_ALL=C readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" + } + +-slog2 { ++qtConfig(slog2): \ + LIBS_PRIVATE += -lslog2 +- DEFINES += QT_USE_SLOG2 +-} + +-journald { ++qtConfig(journald): \ + QMAKE_USE_PRIVATE += journald +- DEFINES += QT_USE_JOURNALD +-} +- +-syslog { +- DEFINES += QT_USE_SYSLOG +-} + + gcc:ltcg { + versiontagging_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) $(INCPATH) +diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h +index 4629a57485..0cbd52c205 100644 +--- a/src/corelib/global/qconfig-bootstrapped.h ++++ b/src/corelib/global/qconfig-bootstrapped.h +@@ -69,10 +69,13 @@ + #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 + #define QT_NO_DATASTREAM + #define QT_FEATURE_iconv -1 ++#define QT_FEATURE_journald -1 + #define QT_NO_LIBRARY + #define QT_FEATURE_library -1 + #define QT_NO_QOBJECT + #define QT_NO_SYSTEMLOCALE ++#define QT_FEATURE_slog2 -1 ++#define QT_FEATURE_syslog -1 + #define QT_NO_THREAD + #define QT_FEATURE_timezone -1 + #define QT_FEATURE_topleveldomain -1 +diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp +index f344873276..0506d372b6 100644 +--- a/src/corelib/global/qlogging.cpp ++++ b/src/corelib/global/qlogging.cpp +@@ -39,6 +39,7 @@ + ** + ****************************************************************************/ + ++#include "qglobal_p.h" + #include "qlogging.h" + #include "qlist.h" + #include "qbytearray.h" +@@ -59,7 +60,7 @@ + #ifdef Q_OS_WIN + #include <qt_windows.h> + #endif +-#ifdef QT_USE_SLOG2 ++#if QT_CONFIG(slog2) + #include <slog2.h> + #endif + +@@ -67,12 +68,12 @@ + #include <android/log.h> + #endif + +-#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) ++#if QT_CONFIG(journald) + # define SD_JOURNAL_SUPPRESS_LOCATION + # include <systemd/sd-journal.h> + # include <syslog.h> + #endif +-#if defined(QT_USE_SYSLOG) && !defined(QT_BOOTSTRAPPED) ++#if QT_CONFIG(syslog) + # include <syslog.h> + #endif + #ifdef Q_OS_UNIX +@@ -93,7 +94,7 @@ + # endif + #endif + +-#if defined(QT_USE_SLOG2) ++#if QT_CONFIG(slog2) + extern char *__progname; + #endif + +@@ -1281,7 +1282,7 @@ static QString formatBacktraceForLogMessage(const QMessagePattern::BacktracePara + } + #endif // QLOGGING_HAVE_BACKTRACE && !QT_BOOTSTRAPPED + +-#if defined(QT_USE_SLOG2) ++#if QT_CONFIG(slog2) + #ifndef QT_LOG_CODE + #define QT_LOG_CODE 9000 + #endif +@@ -1330,7 +1331,7 @@ static void slog2_default_handler(QtMsgType msgType, const char *message) + //writes to the slog2 buffer + slog2c(NULL, QT_LOG_CODE, severity, message); + } +-#endif // QT_USE_SLOG2 ++#endif // slog2 + + Q_GLOBAL_STATIC(QMessagePattern, qMessagePattern) + +@@ -1479,7 +1480,7 @@ static QBasicAtomicPointer<void (QtMsgType, const char*)> msgHandler = Q_BASIC_A + // pointer to QtMessageHandler debug handler (with context) + static QBasicAtomicPointer<void (QtMsgType, const QMessageLogContext &, const QString &)> messageHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMessageHandler); + +-#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) ++#if QT_CONFIG(journald) + static void systemd_default_message_handler(QtMsgType type, + const QMessageLogContext &context, + const QString &message) +@@ -1513,7 +1514,7 @@ static void systemd_default_message_handler(QtMsgType type, + } + #endif + +-#ifdef QT_USE_SYSLOG ++#if QT_CONFIG(syslog) + static void syslog_default_message_handler(QtMsgType type, const char *message) + { + int priority = LOG_INFO; // Informational +@@ -1577,14 +1578,14 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con + logMessage.append(QLatin1Char('\n')); + OutputDebugString(reinterpret_cast<const wchar_t *>(logMessage.utf16())); + return; +-#elif defined(QT_USE_SLOG2) ++#elif QT_CONFIG(slog2) + logMessage.append(QLatin1Char('\n')); + slog2_default_handler(type, logMessage.toLocal8Bit().constData()); + return; +-#elif defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) ++#elif QT_CONFIG(journald) + systemd_default_message_handler(type, context, logMessage); + return; +-#elif defined(QT_USE_SYSLOG) && !defined(QT_BOOTSTRAPPED) ++#elif QT_CONFIG(syslog) + syslog_default_message_handler(type, logMessage.toUtf8().constData()); + return; + #elif defined(Q_OS_ANDROID) diff --git a/qt5-webengine-nss.patch b/qt5-webengine-nss.patch new file mode 100644 index 000000000000..6c0cdf1c74d5 --- /dev/null +++ b/qt5-webengine-nss.patch @@ -0,0 +1,31 @@ +diff -ur qtwebengine-opensource-src-5.6.0-beta/src/3rdparty/chromium/net/socket/ssl_client_socket_openssl.cc +qtwebengine-opensource-src-5.6.0-beta-chimera-nss-init/src/3rdparty/chromium/net/socket/ssl_client_socket_openssl.cc +--- qtwebengine-opensource-src-5.6.0-beta/src/3rdparty/chromium/net/socket/ssl_client_socket_openssl.cc 2015-12-10 18:17:21.000000000 +0100 ++++ qtwebengine-opensource-src-5.6.0-beta-chimera-nss-init/src/3rdparty/chromium/net/socket/ssl_client_socket_openssl.cc 2016-01-14 +17:11:38.432633534 +0100 +@@ -57,6 +57,10 @@ + #include "net/ssl/ssl_platform_key.h" + #endif + ++#if defined(USE_NSS_CERTS) || defined(OS_IOS) ++#include "net/cert_net/nss_ocsp.h" ++#endif ++ + namespace net { + + namespace { +@@ -795,6 +799,14 @@ + DCHECK(!ssl_); + DCHECK(!transport_bio_); + ++#if defined(USE_NSS_CERTS) || defined(OS_IOS) ++ if (ssl_config_.cert_io_enabled) { ++ // TODO(davidben): Move this out of SSLClientSocket. See ++ // https://crbug.com/539520. ++ EnsureNSSHttpIOInit(); ++ } ++#endif ++ + SSLContext* context = SSLContext::GetInstance(); + crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); + diff --git a/qt5-webkit-icu59.patch b/qt5-webkit-icu59.patch new file mode 100644 index 000000000000..2ad514c6ad9f --- /dev/null +++ b/qt5-webkit-icu59.patch @@ -0,0 +1,73 @@ +diff --git a/Source/WTF/wtf/Compiler.h b/Source/WTF/wtf/Compiler.h +index ead844f..e62cfd4 100644 +--- a/Source/WTF/wtf/Compiler.h ++++ b/Source/WTF/wtf/Compiler.h +@@ -61,6 +61,7 @@ + #define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_feature(has_trivial_destructor) + #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_feature(cxx_strong_enums) + #define WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS __has_feature(cxx_reference_qualified_functions) ++#define WTF_COMPILER_SUPPORTS_CXX_NEW_CHAR_TYPES !defined(_LIBCPP_HAS_NO_UNICODE_CHARS) + + #endif + +@@ -142,6 +143,7 @@ + #define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1 + #endif + #if GCC_VERSION_AT_LEAST(4, 5, 0) ++#define WTF_COMPILER_SUPPORTS_CXX_NEW_CHAR_TYPES 1 + #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1 + #endif + #if GCC_VERSION_AT_LEAST(4, 6, 0) +diff --git a/Source/WTF/wtf/TypeTraits.h b/Source/WTF/wtf/TypeTraits.h +index b9e46bc..876fa45 100644 +--- a/Source/WTF/wtf/TypeTraits.h ++++ b/Source/WTF/wtf/TypeTraits.h +@@ -75,6 +75,10 @@ namespace WTF { + #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED) + template<> struct IsInteger<wchar_t> { static const bool value = true; }; + #endif ++#if COMPILER_SUPPORTS(CXX_NEW_CHAR_TYPES) ++ template<> struct IsInteger<char16_t> { static const bool value = true; }; ++ template<> struct IsInteger<char32_t> { static const bool value = true; }; ++#endif + + template<typename T> struct IsFloatingPoint { static const bool value = false; }; + template<> struct IsFloatingPoint<float> { static const bool value = true; }; +---qtwebkit-opensource-src-5.5.1/Source/JavaScriptCore/API/JSStringRef.h.orig 2015-10-13 06:37:10.000000000 +0200 ++++ qtwebkit-opensource-src-5.5.1/Source/JavaScriptCore/API/JSStringRef.h 2017-04-24 12:26:42.495345570 +0200 +@@ -32,6 +32,7 @@ + #include <stdbool.h> + #endif + #include <stddef.h> /* for size_t */ ++#include <uchar.h> + + #ifdef __cplusplus + extern "C" { +@@ -43,7 +44,7 @@ + @typedef JSChar + @abstract A Unicode character. + */ +- typedef unsigned short JSChar; ++ typedef char16_t JSChar; + #else + typedef wchar_t JSChar; + #endif +--- qtwebkit-opensource-src-5.5.1/Source/WebKit2/Shared/API/c/WKString.h.orig 2015-10-13 06:37:12.000000000 +0200 ++++ qtwebkit-opensource-src-5.5.1/Source/WebKit2/Shared/API/c/WKString.h 2017-04-24 12:27:33.432011867 +0200 +@@ -31,6 +31,7 @@ + #ifndef __cplusplus + #include <stdbool.h> + #endif ++#include <uchar.h> + + #ifdef __cplusplus + extern "C" { +@@ -38,7 +39,7 @@ + + #if !defined(WIN32) && !defined(_WIN32) \ + && !((defined(__CC_ARM) || defined(__ARMCC__)) && !defined(__linux__)) /* RVCT */ +- typedef unsigned short WKChar; ++ typedef char16_t WKChar; + #else + typedef wchar_t WKChar; + #endif diff --git a/qt58.PATH b/qt58.PATH new file mode 100644 index 000000000000..f8f53b72efcf --- /dev/null +++ b/qt58.PATH @@ -0,0 +1,4 @@ +export PATH=/opt/qt58/bin:$PATH +export LD_LIBRARY_PATH=/opt/qt58/lib:$LD_LIBRARY_PATH +export PKG_CONFIG_PATH=/opt/qt58/lib/pkgconfig:$PKG_CONFIG_PATH + diff --git a/qtbug-53375.patch b/qtbug-53375.patch new file mode 100644 index 000000000000..4af314624452 --- /dev/null +++ b/qtbug-53375.patch @@ -0,0 +1,113 @@ +From e5498f154425c1e07bbea32624a7495099b3ab9b Mon Sep 17 00:00:00 2001 +From: Felix Schindler <aur@felixschindler.net> +Date: Fri, 28 Jul 2017 18:27:03 +0200 +Subject: [PATCH] Remove -isystem from qmake due to QTBUG-53375 + +This is just https://codereview.qt-project.org/#/c/159215 applied +to the 5.8.0 sources, due to +https://bugreports.qt.io/browse/QTBUG-53375. +--- + qtbase/mkspecs/common/clang.conf | 1 - + qtbase/mkspecs/common/gcc-base.conf | 1 - + qtbase/mkspecs/linux-icc/qmake.conf | 1 - + qtbase/qmake/generators/unix/unixmake2.cpp | 14 +++----------- + qtbase/qmake/generators/win32/mingw_make.cpp | 8 +------- + 5 files changed, 4 insertions(+), 21 deletions(-) + +diff --git a/qtbase/mkspecs/common/clang.conf b/qtbase/mkspecs/common/clang.conf +index e003b94..11ee10f 100644 +--- a/qtbase/mkspecs/common/clang.conf ++++ b/qtbase/mkspecs/common/clang.conf +@@ -16,7 +16,6 @@ QMAKE_LINK_SHLIB = $$QMAKE_CXX + CONFIG += clang_pch_style + QMAKE_PCH_OUTPUT_EXT = .pch + +-QMAKE_CFLAGS_ISYSTEM = -isystem + QMAKE_CFLAGS_PRECOMPILE = -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} + QMAKE_CFLAGS_USE_PRECOMPILE = -Xclang -include-pch -Xclang ${QMAKE_PCH_OUTPUT} + QMAKE_CFLAGS_LTCG = -flto +diff --git a/qtbase/mkspecs/common/gcc-base.conf b/qtbase/mkspecs/common/gcc-base.conf +index 6e043f5..df8d314 100644 +--- a/qtbase/mkspecs/common/gcc-base.conf ++++ b/qtbase/mkspecs/common/gcc-base.conf +@@ -44,7 +44,6 @@ QMAKE_CFLAGS_DEBUG += -g + QMAKE_CFLAGS_SHLIB += -fPIC + QMAKE_CFLAGS_STATIC_LIB += -fPIC + QMAKE_CFLAGS_APP += -fPIC +-QMAKE_CFLAGS_ISYSTEM = -isystem + QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses + QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden + QMAKE_CFLAGS_EXCEPTIONS_OFF += -fno-exceptions +diff --git a/qtbase/mkspecs/linux-icc/qmake.conf b/qtbase/mkspecs/linux-icc/qmake.conf +index 2c66e80..a4fd592 100644 +--- a/qtbase/mkspecs/linux-icc/qmake.conf ++++ b/qtbase/mkspecs/linux-icc/qmake.conf +@@ -21,7 +21,6 @@ QMAKE_CFLAGS_DEBUG = -O0 -g + QMAKE_CFLAGS_SHLIB = -fPIC + QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB + QMAKE_CFLAGS_YACC = +-QMAKE_CFLAGS_ISYSTEM = -isystem + QMAKE_CFLAGS_THREAD = -D_REENTRANT + QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections + QMAKE_CFLAGS_LTCG = -ipo -fno-fat-lto-objects +diff --git a/qtbase/qmake/generators/unix/unixmake2.cpp b/qtbase/qmake/generators/unix/unixmake2.cpp +index 6fa3553..a826cdc 100644 +--- a/qtbase/qmake/generators/unix/unixmake2.cpp ++++ b/qtbase/qmake/generators/unix/unixmake2.cpp +@@ -176,16 +176,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) + t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; + t << "INCPATH ="; + { +- QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); + const ProStringList &incs = project->values("INCLUDEPATH"); + for(int i = 0; i < incs.size(); ++i) { + const ProString &inc = incs.at(i); +- if (inc.isEmpty()) +- continue; +- +- if (!isystem.isEmpty() && isSystemInclude(inc.toQString())) +- t << ' ' << isystem << ' '; +- else ++ if (!inc.isEmpty()) + t << " -I"; + t << escapeFilePath(inc); + } +@@ -1358,10 +1352,8 @@ void UnixMakefileGenerator::init2() + } + + if (include_deps && project->isActiveConfig("gcc_MD_depends")) { +- // use -MMD if we know about -isystem too +- ProString MD_flag(project->values("QMAKE_CFLAGS_ISYSTEM").isEmpty() ? "-MD" : "-MMD"); +- project->values("QMAKE_CFLAGS") += MD_flag; +- project->values("QMAKE_CXXFLAGS") += MD_flag; ++ project->values("QMAKE_CFLAGS") += "-MD"; ++ project->values("QMAKE_CXXFLAGS") += "-MD"; + } + } + +diff --git a/qtbase/qmake/generators/win32/mingw_make.cpp b/qtbase/qmake/generators/win32/mingw_make.cpp +index 8d5a9a7..9e67500 100644 +--- a/qtbase/qmake/generators/win32/mingw_make.cpp ++++ b/qtbase/qmake/generators/win32/mingw_make.cpp +@@ -249,17 +249,11 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) + { + t << "INCPATH = "; + +- QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); + const ProStringList &incs = project->values("INCLUDEPATH"); + for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { + QString inc = (*incit).toQString(); + inc.replace(QRegExp("\\\\$"), ""); +- +- if (!isystem.isEmpty() && isSystemInclude(inc)) +- t << isystem << ' '; +- else +- t << "-I"; +- t << escapeFilePath(inc) << ' '; ++ t << "-I" << escapeFilePath(inc) << ' '; + } + t << endl; + } +-- +2.13.3 + diff --git a/qtwebengine-5.7.0-icu58.patch b/qtwebengine-5.7.0-icu58.patch new file mode 100644 index 000000000000..f3f6bdee01e2 --- /dev/null +++ b/qtwebengine-5.7.0-icu58.patch @@ -0,0 +1,105 @@ +From 424584b4984bde7c831f42e9fb47f1ad583a1c46 Mon Sep 17 00:00:00 2001 +From: jshin <jshin@chromium.org> +Date: Fri, 21 Oct 2016 01:15:50 -0700 +Subject: [PATCH] Update aspirational_scripts per Unicode 9 + +This is a preparation to update ICU to 58.1. +Without this change, ICU update CL cannot be tested on +trybots because a compile will fail due to '#error' checking +if ICU version is less than 58. + +BUG=637001 +TEST=None +TBR=pkasting@chromium.org + +Review-Url: https://chromiumcodereview.appspot.com/2436113003 +Cr-Commit-Position: refs/heads/master@{#426749} +--- + components/url_formatter/url_formatter.cc | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/components/url_formatter/url_formatter.cc b/components/url_formatter/url_formatter.cc +index 4455db3..2b82c0c 100644 +--- qtwebengine-opensource-src-5.7.0.orig/src/3rdparty/chromium/components/url_formatter/url_formatter.cc ++++ qtwebengine-opensource-src-5.7.0/src/3rdparty/chromium/components/url_formatter/url_formatter.cc +@@ -428,9 +428,9 @@ void IDNSpoofChecker::SetAllowedUnicodeSet(UErrorCode* status) { + // section at + // http://www.unicode.org/Public/security/latest/xidmodifications.txt) are + // are added to the allowed set. The list has to be updated when a new +- // version of Unicode is released. The current version is 8.0.0 and ICU 58 +- // will have Unicode 9.0 data. +-#if U_ICU_VERSION_MAJOR_NUM < 58 ++ // version of Unicode is released. The current version is 9.0.0 and ICU 60 ++ // will have Unicode 10.0 data. ++#if U_ICU_VERSION_MAJOR_NUM < 60 + const icu::UnicodeSet aspirational_scripts( + icu::UnicodeString( + // Unified Canadian Syllabics +@@ -444,13 +444,13 @@ void IDNSpoofChecker::SetAllowedUnicodeSet(UErrorCode* status) { + // Yi + "\\uA000-\\uA48C" + // Miao +- "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7F" ++ "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7E" + "\\U00016F8F-\\U00016F9F]", + -1, US_INV), + *status); + allowed_set.addAll(aspirational_scripts); + #else +-#error "Update aspirational_scripts per Unicode 9.0" ++#error "Update aspirational_scripts per Unicode 10.0" + #endif + + // U+0338 is included in the recommended set, while U+05F4 and U+2027 are in +diff -Naur qtwebengine-opensource-src-5.7.0.orig/src/3rdparty/chromium/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp +qtwebengine-opensource-src-5.7.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp +--- qtwebengine-opensource-src-5.7.0.orig/src/3rdparty/chromium/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp 2016-11-15 17:07:38.680665385 -0800 ++++ qtwebengine-opensource-src-5.7.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp 2016-11-15 17:12:17.564001354 -0800 +@@ -26,6 +26,9 @@ + #include "wtf/StdLibExtras.h" + #include "wtf/text/CharacterNames.h" + ++#include <unicode/uchar.h> ++#include <unicode/uvernum.h> ++ + namespace blink { + + unsigned numGraphemeClusters(const String& string) +@@ -122,13 +125,18 @@ + { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // DEL + }; + ++#if U_ICU_VERSION_MAJOR_NUM >= 58 ++#define BA_LB_COUNT (U_LB_COUNT - 3) ++#else ++#define BA_LB_COUNT U_LB_COUNT ++#endif + // Line breaking table for CSS word-break: break-all. This table differs from + // asciiLineBreakTable in: + // - Indices are Line Breaking Classes defined in UAX#14 Unicode Line Breaking + // Algorithm: http://unicode.org/reports/tr14/#DescriptionOfProperties + // - 1 indicates additional break opportunities. 0 indicates to fallback to + // normal line break, not "prohibit break." +-static const unsigned char breakAllLineBreakClassTable[][U_LB_COUNT / 8 + 1] = { ++static const unsigned char breakAllLineBreakClassTable[][BA_LB_COUNT / 8 + 1] = { + // XX AI AL B2 BA BB BK CB CL CM CR EX GL HY ID IN IS LF NS NU OP PO PR QU SA SG SP SY ZW NL WJ H2 H3 JL JT JV CP CJ HL RI + { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // XX + { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // AI +@@ -178,7 +186,7 @@ + #undef AL + + static_assert(WTF_ARRAY_LENGTH(asciiLineBreakTable) == asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar + 1, "asciiLineBreakTable should be consistent"); +-static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == U_LB_COUNT, "breakAllLineBreakClassTable should be consistent"); ++static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == BA_LB_COUNT, "breakAllLineBreakClassTable should be consistent"); + + static inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh) + { +@@ -209,7 +217,7 @@ + + static inline bool shouldBreakAfterBreakAll(ULineBreak lastLineBreak, ULineBreak lineBreak) + { +- if (lineBreak >= 0 && lineBreak < U_LB_COUNT && lastLineBreak >= 0 && lastLineBreak < U_LB_COUNT) { ++ if (lineBreak >= 0 && lineBreak < BA_LB_COUNT && lastLineBreak >= 0 && lastLineBreak < BA_LB_COUNT) { + const unsigned char* tableRow = breakAllLineBreakClassTable[lastLineBreak]; + return tableRow[lineBreak / 8] & (1 << (lineBreak % 8)); + } diff --git a/revert-5b807802.patch b/revert-5b807802.patch new file mode 100644 index 000000000000..b8665534c09e --- /dev/null +++ b/revert-5b807802.patch @@ -0,0 +1,542 @@ +From 5b807802866c8df00cb3340d4f9bcc343be5973a Mon Sep 17 00:00:00 2001 +From: Giulio Camuffo <giulio.camuffo@kdab.com> +Date: Sat, 2 Jul 2016 10:46:58 +0200 +Subject: [PATCH] Create and destroy the shell surface when showing and hiding + +This changes the shell surface handling for windows, and instead of +creating the shell surface at initialization time, and then attaching +a null buffer to hide it, it creates the shell surface on setVisible(true), +and destroys it on setVisible(false). +This fixes hiding when using xdg_shell, as that interface defines that +attaching a null buffer to an xdg_surface is an error. +Also this should help with bugged EGL drivers which attach a buffer +after eglSwapBuffers() returns, which used to cause a newly hidden +window to get a new valid buffer after we attached a null one, showing +it again. + +Task-number: QTBUG-47902 +Change-Id: I8e0a0442319a98cc1361803ea7be1d079b36fc8c +Reviewed-by: Johan Helsing <johan.helsing@qt.io> +Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> +--- + src/client/qwaylandshellsurface_p.h | 5 +- + src/client/qwaylandshmbackingstore.cpp | 8 +- + src/client/qwaylandwindow.cpp | 90 +++++++++++----------- + src/client/qwaylandwindow_p.h | 2 + + src/client/qwaylandwlshellsurface.cpp | 10 +++ + src/client/qwaylandwlshellsurface_p.h | 6 +- + src/client/qwaylandxdgpopup.cpp | 6 ++ + src/client/qwaylandxdgpopup_p.h | 2 + + src/client/qwaylandxdgsurface.cpp | 19 ++--- + src/client/qwaylandxdgsurface_p.h | 5 +- + .../client/wayland-egl/qwaylandeglwindow.cpp | 10 +++ + .../client/wayland-egl/qwaylandeglwindow.h | 4 + + .../qwaylandxcompositeeglcontext.cpp | 4 +- + .../qwaylandxcompositeglxcontext.cpp | 4 +- + .../ivi-shell/qwaylandivisurface.cpp | 7 ++ + .../ivi-shell/qwaylandivisurface_p.h | 2 + + tests/auto/client/client/tst_client.cpp | 4 +- + 17 files changed, 110 insertions(+), 78 deletions(-) + +diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h +index 63b77ab..b51c252 100644 +--- a/src/client/qwaylandshellsurface_p.h ++++ b/src/client/qwaylandshellsurface_p.h +@@ -94,15 +94,14 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject + + inline QWaylandWindow *window() { return m_window; } + ++ virtual void setType(Qt::WindowType type, QWaylandWindow *transientParent) = 0; ++ + protected: + virtual void setMaximized() {} + virtual void setFullscreen() {} + virtual void setNormal() {} + virtual void setMinimized() {} + +- virtual void setTopLevel() {} +- virtual void updateTransientParent(QWindow * /*parent*/) {} +- + private: + QWaylandWindow *m_window; + friend class QWaylandWindow; +diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp +index 5f8336c..d0d6cfd 100644 +--- a/src/client/qwaylandshmbackingstore.cpp ++++ b/src/client/qwaylandshmbackingstore.cpp +@@ -211,13 +211,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons + + QMargins margins = windowDecorationMargins(); + +- waylandWindow()->attachOffset(mFrontBuffer); +- mFrontBuffer->setBusy(); +- +- QVector<QRect> rects = region.rects(); +- foreach (const QRect &rect, rects) +- waylandWindow()->damage(rect.translated(margins.left(), margins.top())); +- waylandWindow()->commit(); ++ waylandWindow()->commit(mFrontBuffer, region.translated(margins.left(), margins.top())); + } + + void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) +diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp +index 6c3647d..1ff6686 100644 +--- a/src/client/qwaylandwindow.cpp ++++ b/src/client/qwaylandwindow.cpp +@@ -96,8 +96,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) + { + static WId id = 1; + mWindowId = id++; +- if (window->type() != Qt::Desktop) +- initWindow(); + } + + QWaylandWindow::~QWaylandWindow() +@@ -126,18 +124,28 @@ QWaylandWindow::~QWaylandWindow() + + void QWaylandWindow::initWindow() + { +- init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this))); ++ if (window()->type() == Qt::Desktop) ++ return; ++ ++ if (!isInitialized()) ++ init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this))); + + if (shouldCreateSubSurface()) { ++ Q_ASSERT(!mSubSurfaceWindow); ++ + QWaylandWindow *p = static_cast<QWaylandWindow *>(QPlatformWindow::parent()); + if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { + mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); + } + } else if (shouldCreateShellSurface()) { ++ Q_ASSERT(!mShellSurface); ++ + mShellSurface = mDisplay->createShellSurface(this); +- } ++ if (!mShellSurface) ++ qFatal("Could not create a shell surface object."); ++ ++ mShellSurface->setType(window()->type(), transientParent()); + +- if (mShellSurface) { + // Set initial surface title + setWindowTitle(window()->title()); + +@@ -171,17 +179,6 @@ void QWaylandWindow::initWindow() + } + } + +- if (mShellSurface) { +- if (window()->transientParent()) { +- if (window()->type() != Qt::Popup) { +- mShellSurface->updateTransientParent(window()->transientParent()); +- } +- } else { +- if (window()->type() != Qt::ToolTip) +- mShellSurface->setTopLevel(); +- } +- } +- + // Enable high-dpi rendering. Scale() returns the screen scale factor and will + // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() + // to inform the compositor that high-resolution buffers will be provided. +@@ -244,6 +241,9 @@ WId QWaylandWindow::winId() const + + void QWaylandWindow::setParent(const QPlatformWindow *parent) + { ++ if (!window()->isVisible()) ++ return; ++ + QWaylandWindow *oldparent = mSubSurfaceWindow ? mSubSurfaceWindow->parent() : 0; + if (oldparent == parent) + return; +@@ -287,8 +287,7 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) + QMargins m = QPlatformWindow::parent()->frameMargins(); + mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top()); + mSubSurfaceWindow->parent()->window()->requestUpdate(); +- } else if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup) +- shellSurface()->updateTransientParent(window()->transientParent()); ++ } + } + + void QWaylandWindow::setGeometry(const QRect &rect) +@@ -313,20 +312,8 @@ void QWaylandWindow::setGeometry(const QRect &rect) + void QWaylandWindow::setVisible(bool visible) + { + if (visible) { +- if (mShellSurface) { +- if (window()->type() == Qt::Popup) { +- QWaylandWindow *parent = transientParent(); +- if (parent) { +- QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface); +- if (wlshellSurface) +- wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); +- } +- } else if (window()->type() == Qt::ToolTip) { +- if (QWaylandWindow *parent = transientParent()) { +- mShellSurface->updateTransientParent(parent->window()); +- } +- } +- } ++ initWindow(); ++ mDisplay->flushRequests(); + + setGeometry(window()->geometry()); + // Don't flush the events here, or else the newly visible window may start drawing, but since +@@ -338,10 +325,8 @@ void QWaylandWindow::setVisible(bool visible) + // case 'this' will be deleted. When that happens, we must abort right away. + QPointer<QWaylandWindow> deleteGuard(this); + QWindowSystemInterface::flushWindowSystemEvents(); +- if (!deleteGuard.isNull()) { +- attach(static_cast<QWaylandBuffer *>(0), 0, 0); +- commit(); +- } ++ if (!deleteGuard.isNull()) ++ reset(); + } + } + +@@ -374,7 +359,7 @@ void QWaylandWindow::setMask(const QRegion &mask) + wl_region_destroy(region); + } + +- commit(); ++ wl_surface::commit(); + } + + void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height) +@@ -461,6 +446,7 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) + wl_callback_add_listener(callback, &QWaylandWindow::callbackListener, this); + mFrameCallback = callback; + mWaitingForFrameSync = true; ++ buffer->setBusy(); + + attach(buffer->buffer(), x, y); + } else { +@@ -479,6 +465,18 @@ void QWaylandWindow::damage(const QRect &rect) + damage(rect.x(), rect.y(), rect.width(), rect.height()); + } + ++void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) ++{ ++ if (!isInitialized()) ++ return; ++ ++ attachOffset(buffer); ++ const QVector<QRect> rects = damage.rects(); ++ for (const QRect &rect: rects) ++ wl_surface::damage(rect.x(), rect.y(), rect.width(), rect.height()); ++ wl_surface::commit(); ++} ++ + const wl_callback_listener QWaylandWindow::callbackListener = { + QWaylandWindow::frameCallback + }; +@@ -555,7 +553,7 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient + } + set_buffer_transform(transform); + // set_buffer_transform is double buffered, we need to commit. +- commit(); ++ wl_surface::commit(); + } + + void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) +@@ -681,15 +679,13 @@ static QWindow *topLevelWindow(QWindow *window) + + QWaylandWindow *QWaylandWindow::transientParent() const + { +- if (window()->transientParent()) { +- // Take the top level window here, since the transient parent may be a QWidgetWindow +- // or some other window without a shell surface, which is then not able to get mouse +- // events. +- return static_cast<QWaylandWindow *>(topLevelWindow(window()->transientParent())->handle()); +- } +- // Try with the current focus window. It should be the right one and anyway +- // better than having no parent at all. +- return mDisplay->lastInputWindow(); ++ // Take the top level window here, since the transient parent may be a QWidgetWindow ++ // or some other window without a shell surface, which is then not able to get mouse ++ // events. ++ if (auto transientParent = window()->transientParent()) ++ return static_cast<QWaylandWindow *>(topLevelWindow(transientParent)->handle()); ++ ++ return nullptr; + } + + void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) +diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h +index 442fe9a..7e7078f 100644 +--- a/src/client/qwaylandwindow_p.h ++++ b/src/client/qwaylandwindow_p.h +@@ -132,6 +132,8 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformW + using QtWayland::wl_surface::damage; + void damage(const QRect &rect); + ++ void commit(QWaylandBuffer *buffer, const QRegion &damage); ++ + void waitForFrameSync(); + + QMargins frameMargins() const Q_DECL_OVERRIDE; +diff --git a/src/client/qwaylandwlshellsurface.cpp b/src/client/qwaylandwlshellsurface.cpp +index 3527015..77434e9 100644 +--- a/src/client/qwaylandwlshellsurface.cpp ++++ b/src/client/qwaylandwlshellsurface.cpp +@@ -215,6 +215,16 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic + transientPos.x(), transientPos.y(), 0); + } + ++void QWaylandWlShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) ++{ ++ if (type == Qt::Popup && transientParent) ++ setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); ++ else if (transientParent) ++ updateTransientParent(transientParent->window()); ++ else ++ setTopLevel(); ++} ++ + void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial) + { + pong(serial); +diff --git a/src/client/qwaylandwlshellsurface_p.h b/src/client/qwaylandwlshellsurface_p.h +index ef732ef..af86276 100644 +--- a/src/client/qwaylandwlshellsurface_p.h ++++ b/src/client/qwaylandwlshellsurface_p.h +@@ -92,14 +92,16 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurfa + void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; + void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + ++ void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; ++ + private: + void setMaximized() Q_DECL_OVERRIDE; + void setFullscreen() Q_DECL_OVERRIDE; + void setNormal() Q_DECL_OVERRIDE; + void setMinimized() Q_DECL_OVERRIDE; + +- void setTopLevel() Q_DECL_OVERRIDE; +- void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; ++ void setTopLevel(); ++ void updateTransientParent(QWindow *parent); + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + + QWaylandWindow *m_window; +diff --git a/src/client/qwaylandxdgpopup.cpp b/src/client/qwaylandxdgpopup.cpp +index abc2527..57800f1 100644 +--- a/src/client/qwaylandxdgpopup.cpp ++++ b/src/client/qwaylandxdgpopup.cpp +@@ -56,6 +56,12 @@ QWaylandXdgPopup::~QWaylandXdgPopup() + delete m_extendedWindow; + } + ++void QWaylandXdgPopup::setType(Qt::WindowType type, QWaylandWindow *transientParent) ++{ ++ Q_UNUSED(type); ++ Q_UNUSED(transientParent); ++} ++ + void QWaylandXdgPopup::xdg_popup_popup_done() + { + m_window->window()->close(); +diff --git a/src/client/qwaylandxdgpopup_p.h b/src/client/qwaylandxdgpopup_p.h +index ff58041..64bb4d9 100644 +--- a/src/client/qwaylandxdgpopup_p.h ++++ b/src/client/qwaylandxdgpopup_p.h +@@ -68,6 +68,8 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopup : public QWaylandShellSurface + QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window); + virtual ~QWaylandXdgPopup(); + ++ void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; ++ + protected: + void xdg_popup_popup_done() override; + +diff --git a/src/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp +index a3bbb06..fe8761e 100644 +--- a/src/client/qwaylandxdgsurface.cpp ++++ b/src/client/qwaylandxdgsurface.cpp +@@ -128,17 +128,11 @@ void QWaylandXdgSurface::setMinimized() + set_minimized(); + } + +-void QWaylandXdgSurface::setTopLevel() ++void QWaylandXdgSurface::updateTransientParent(QWaylandWindow *parent) + { +- // There's no xdg_shell_surface API for this, ignoring +-} +- +-void QWaylandXdgSurface::updateTransientParent(QWindow *parent) +-{ +- QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle()); +- if (!parent_wayland_window) ++ if (!parent) + return; +- auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(parent_wayland_window->shellSurface()); ++ auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(parent->shellSurface()); + Q_ASSERT(parentXdgSurface); + set_parent(parentXdgSurface->object()); + } +@@ -183,6 +177,13 @@ void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value + m_extendedWindow->updateGenericProperty(name, value); + } + ++void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) ++{ ++ Q_UNUSED(type) ++ if (transientParent) ++ updateTransientParent(transientParent); ++} ++ + void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) + { + uint32_t *state = reinterpret_cast<uint32_t*>(states->data); +diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h +index 1a5eeed..265d3ba 100644 +--- a/src/client/qwaylandxdgsurface_p.h ++++ b/src/client/qwaylandxdgsurface_p.h +@@ -99,14 +99,15 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface + bool isFullscreen() const { return m_fullscreen; } + bool isMaximized() const { return m_maximized; } + ++ void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; ++ + private: + void setMaximized() Q_DECL_OVERRIDE; + void setFullscreen() Q_DECL_OVERRIDE; + void setNormal() Q_DECL_OVERRIDE; + void setMinimized() Q_DECL_OVERRIDE; + +- void setTopLevel() Q_DECL_OVERRIDE; +- void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; ++ void updateTransientParent(QWaylandWindow *parent); + + private: + QWaylandWindow *m_window; +diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp +index 236218e..6b5c532 100644 +--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ++++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp +@@ -159,6 +159,12 @@ void QWaylandEglWindow::setVisible(bool visible) + { + QWaylandWindow::setVisible(visible); + if (!visible) ++ QMetaObject::invokeMethod(this, "doInvalidateSurface", Qt::QueuedConnection); ++} ++ ++void QWaylandEglWindow::doInvalidateSurface() ++{ ++ if (!window()->isVisible()) + invalidateSurface(); + } + +@@ -168,6 +174,10 @@ void QWaylandEglWindow::invalidateSurface() + eglDestroySurface(m_clientBufferIntegration->eglDisplay(), m_eglSurface); + m_eglSurface = 0; + } ++ if (m_waylandEglWindow) { ++ wl_egl_window_destroy(m_waylandEglWindow); ++ m_waylandEglWindow = nullptr; ++ } + } + + EGLSurface QWaylandEglWindow::eglSurface() const +diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h +index 556ed68..bf65668 100644 +--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h ++++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h +@@ -54,6 +54,7 @@ class QWaylandGLContext; + + class QWaylandEglWindow : public QWaylandWindow + { ++ Q_OBJECT + public: + QWaylandEglWindow(QWindow *window); + ~QWaylandEglWindow(); +@@ -75,6 +76,9 @@ class QWaylandEglWindow : public QWaylandWindow + void invalidateSurface() Q_DECL_OVERRIDE; + void setVisible(bool visible) Q_DECL_OVERRIDE; + ++private Q_SLOTS: ++ void doInvalidateSurface(); ++ + private: + QWaylandEglClientBufferIntegration *m_clientBufferIntegration; + struct wl_egl_window *m_waylandEglWindow; +diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp +index e2e2f55..c07ad53 100644 +--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ++++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp +@@ -64,9 +64,7 @@ void QWaylandXCompositeEGLContext::swapBuffers(QPlatformSurface *surface) + + QSize size = w->geometry().size(); + +- w->attach(w->buffer(), 0, 0); +- w->damage(QRect(QPoint(), size)); +- w->commit(); ++ w->commit(w->buffer(), QRegion(0, 0, size.width(), size.height())); + w->waitForFrameSync(); + } + +diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp +index bc6e94f..439acc0 100644 +--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp ++++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp +@@ -90,9 +90,7 @@ void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface) + + glXSwapBuffers(m_display, w->xWindow()); + +- w->attach(w->buffer(), 0, 0); +- w->damage(QRect(QPoint(), size)); +- w->commit(); ++ w->commit(w->buffer(), QRegion(0, 0, size.width(), size.height())); + w->waitForFrameSync(); + } + +diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp +index f8871fa..ecc47e0 100644 +--- a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp ++++ b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp +@@ -71,6 +71,13 @@ QWaylandIviSurface::~QWaylandIviSurface() + delete m_extendedWindow; + } + ++void QWaylandIviSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) ++{ ++ ++ Q_UNUSED(type) ++ Q_UNUSED(transientParent) ++} ++ + void QWaylandIviSurface::createExtendedSurface(QWaylandWindow *window) + { + if (window->display()->windowExtension()) +diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h +index 96978e2..9ac81ad 100644 +--- a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h ++++ b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h +@@ -56,6 +56,8 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandIviSurface : public QtWayland::ivi_surface + struct ::ivi_controller_surface *iviControllerSurface); + virtual ~QWaylandIviSurface(); + ++ void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; ++ + private: + void createExtendedSurface(QWaylandWindow *window); + virtual void ivi_surface_configure(int32_t width, int32_t height) Q_DECL_OVERRIDE; +diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp +index 74363ef..6aad25b 100644 +--- a/tests/auto/client/client/tst_client.cpp ++++ b/tests/auto/client/client/tst_client.cpp +@@ -248,8 +248,8 @@ void tst_WaylandClient::backingStore() + + window.hide(); + +- // hiding the window should detach the buffer +- QTRY_VERIFY(surface->image.isNull()); ++ // hiding the window should destroy the surface ++ QTRY_VERIFY(!compositor->surface()); + } + + class DndWindow : public QWindow |