summaryrefslogtreecommitdiffstats
path: root/qt5
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2018-02-10 19:37:04 +0000
committer Eric Hameleers <alien@slackware.com>2018-02-10 19:37:04 +0000
commit2f0619421f05326cec4420ae91946f66715a5b53 (patch)
tree77bbe57bf10d422de5dbc9802e464f4170e4effa /qt5
parent9d1bb90fca23d935e03ec74b8607d5d67c8686e8 (diff)
downloadasb-2f0619421f05326cec4420ae91946f66715a5b53.tar.gz
asb-2f0619421f05326cec4420ae91946f66715a5b53.tar.xz
Initial revision
Diffstat (limited to 'qt5')
-rw-r--r--qt5/build/patches/platformplugin-install-path-fix.patch15
-rw-r--r--qt5/build/patches/qt5.alsa.patch11
-rw-r--r--qt5/build/patches/qt5.glibc224.patch33
-rw-r--r--qt5/build/patches/qt5.qlockfile-deadlock.patch116
-rw-r--r--qt5/build/patches/qt5.qtbug-49061.patch80
-rw-r--r--qt5/build/patches/qt5.qtbug-49452.patch58
-rw-r--r--qt5/build/patches/qt5.qtbug-51621.patch39
-rw-r--r--qt5/build/patches/qt5.qtbug-51648.patch88
-rw-r--r--qt5/build/patches/qt5.qtbug-51649.patch159
-rw-r--r--qt5/build/patches/qt5.qtbug-51676.patch126
-rw-r--r--qt5/build/patches/qt5.qtbug-51890.patch82
-rw-r--r--qt5/build/patches/qt5.qtbug-51927.patch185
-rw-r--r--qt5/build/patches/qt5.qtbug-53237.patch90
-rw-r--r--qt5/build/patches/qt5.qtbug-55583.patch41
-rw-r--r--qt5/build/patches/qt5.qtbug-60558.patch32
-rw-r--r--qt5/build/patches/qt5.qtbug-61140.patch101
-rw-r--r--qt5/build/patches/qt5.qtbug-66103.patch172
-rw-r--r--qt5/build/patches/qt5.whandle.patch24
18 files changed, 1452 insertions, 0 deletions
diff --git a/qt5/build/patches/platformplugin-install-path-fix.patch b/qt5/build/patches/platformplugin-install-path-fix.patch
new file mode 100644
index 00000000..db9b33b9
--- /dev/null
+++ b/qt5/build/patches/platformplugin-install-path-fix.patch
@@ -0,0 +1,15 @@
+See https://bugs.webkit.org/show_bug.cgi?id=117077
+
+diff -Naur qt-everywhere-opensource-src-5.0.2.orig/qtwebkit/Source/WebKit/qt/examples/platformplugin/platformplugin.pro qt-everywhere-opensource-src-5.0.2/qtwebkit/Source/WebKit/qt/examples/platformplugin/platformplugin.pro
+--- qt-everywhere-opensource-src-5.0.2.orig/qtwebkit/Source/WebKit/qt/examples/platformplugin/platformplugin.pro 2013-04-09 00:11:38.000000000 +0000
++++ qt-everywhere-opensource-src-5.0.2/qtwebkit/Source/WebKit/qt/examples/platformplugin/platformplugin.pro 2013-05-31 01:18:29.157175082 +0000
+@@ -20,7 +20,8 @@
+ }
+ }
+
+-DESTDIR = $$[QT_INSTALL_PLUGINS]/webkit
++target.path = $$[QT_INSTALL_PLUGINS]/webkit
++INSTALLS += target
+
+ SOURCES += \
+ WebPlugin.cpp \
diff --git a/qt5/build/patches/qt5.alsa.patch b/qt5/build/patches/qt5.alsa.patch
new file mode 100644
index 00000000..892431b3
--- /dev/null
+++ b/qt5/build/patches/qt5.alsa.patch
@@ -0,0 +1,11 @@
+--- qt-everywhere-opensource-src-5.6.0/qtbase/config.tests/unix/alsa/alsatest.cpp.orig 2016-02-29 08:15:48.203031809 +0000
++++ qt-everywhere-opensource-src-5.6.0/qtbase/config.tests/unix/alsa/alsatest.cpp 2016-02-29 08:16:39.712811962 +0000
+@@ -32,7 +32,7 @@
+ ****************************************************************************/
+
+ #include <alsa/asoundlib.h>
+-#if(!(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 10))
++#if(!(SND_LIB_MAJOR == 1 && (SND_LIB_MINOR > 0 || SND_LIB_SUBMINOR >= 10)))
+ #error "Alsa version found too old, require >= 1.0.10"
+ #endif
+
diff --git a/qt5/build/patches/qt5.glibc224.patch b/qt5/build/patches/qt5.glibc224.patch
new file mode 100644
index 00000000..773781ac
--- /dev/null
+++ b/qt5/build/patches/qt5.glibc224.patch
@@ -0,0 +1,33 @@
+From b12ffcd411d4776f7120ccecb3be34344d930d2b Mon Sep 17 00:00:00 2001
+From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
+Date: Tue, 9 Aug 2016 16:21:29 +0200
+Subject: Do not depend on Linux 4.5
+
+Avoid using MADV_FREE that was only recently added to Linux. It will fail when
+run on older Linux kernels.
+
+Change-Id: I9b0369fb31402f088b2327c12f70dd39f5e4c8c0
+Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
+---
+ chromium/third_party/WebKit/Source/wtf/PageAllocator.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/wtf/PageAllocator.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/wtf/PageAllocator.cpp
+index 121b687..be7c3b9 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/wtf/PageAllocator.cpp
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/wtf/PageAllocator.cpp
+@@ -39,6 +39,11 @@
+
+ #include <sys/mman.h>
+
++#if OS(LINUX) && defined(MADV_FREE)
++// Added in Linux 4.5, but we don't want to depend on 4.5 at runtime
++#undef MADV_FREE
++#endif
++
+ #ifndef MADV_FREE
+ #define MADV_FREE MADV_DONTNEED
+ #endif
+--
+cgit v1.0-4-g1e03
+
diff --git a/qt5/build/patches/qt5.qlockfile-deadlock.patch b/qt5/build/patches/qt5.qlockfile-deadlock.patch
new file mode 100644
index 00000000..e51d5ad0
--- /dev/null
+++ b/qt5/build/patches/qt5.qlockfile-deadlock.patch
@@ -0,0 +1,116 @@
+# Taken from:
+# https://projects.archlinux.org/svntogit/packages.git/plain/trunk/qlockfile-deadlock.patch?h=packages/qt5
+# QTBUG-44771
+# ----------------------------------------------------------------------------
+From f58e882b7594c59b6050d3c87562fcf836d10f60 Mon Sep 17 00:00:00 2001
+From: Olivier Goffart <ogoffart@woboq.com>
+Date: Tue, 14 Apr 2015 10:58:26 +0200
+Subject: QLockFile: fix deadlock when the lock file is corrupted
+
+[ChangeLog][QtCore][QLockFile] Fixed a deadlock when the lock file
+is corrupted.
+
+Task-number: QTBUG-44771
+Change-Id: Ic490b09d70ff1cc1733b64949889a73720b2d0f3
+Reviewed-by: David Faure <david.faure@kdab.com>
+---
+ src/corelib/io/qlockfile_unix.cpp | 10 +++++-----
+ src/corelib/io/qlockfile_win.cpp | 22 +++++++++++-----------
+ tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp | 17 +++++++++++++++++
+ 3 files changed, 33 insertions(+), 16 deletions(-)
+
+diff --git a/qtbase/src/corelib/io/qlockfile_unix.cpp b/qtbase/src/corelib/io/qlockfile_unix.cpp
+index bf1015a..dc9f8f7 100644
+--- a/qtbase/src/corelib/io/qlockfile_unix.cpp
++++ b/qtbase/src/corelib/io/qlockfile_unix.cpp
+@@ -181,11 +181,11 @@ bool QLockFilePrivate::isApparentlyStale() const
+ {
+ qint64 pid;
+ QString hostname, appname;
+- if (!getLockInfo(&pid, &hostname, &appname))
+- return false;
+- if (hostname.isEmpty() || hostname == QString::fromLocal8Bit(localHostName())) {
+- if (::kill(pid, 0) == -1 && errno == ESRCH)
+- return true; // PID doesn't exist anymore
++ if (getLockInfo(&pid, &hostname, &appname)) {
++ if (hostname.isEmpty() || hostname == QString::fromLocal8Bit(localHostName())) {
++ if (::kill(pid, 0) == -1 && errno == ESRCH)
++ return true; // PID doesn't exist anymore
++ }
+ }
+ const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());
+ return staleLockTime > 0 && age > staleLockTime;
+diff --git a/qtbase/src/corelib/io/qlockfile_win.cpp b/qtbase/src/corelib/io/qlockfile_win.cpp
+index f9f2909..3587c7b 100644
+--- a/qtbase/src/corelib/io/qlockfile_win.cpp
++++ b/qtbase/src/corelib/io/qlockfile_win.cpp
+@@ -115,21 +115,21 @@ bool QLockFilePrivate::isApparentlyStale() const
+ {
+ qint64 pid;
+ QString hostname, appname;
+- if (!getLockInfo(&pid, &hostname, &appname))
+- return false;
+
+ // On WinRT there seems to be no way of obtaining information about other
+ // processes due to sandboxing
+ #ifndef Q_OS_WINRT
+- if (hostname == QString::fromLocal8Bit(localHostName())) {
+- HANDLE procHandle = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
+- if (!procHandle)
+- return true;
+- // We got a handle but check if process is still alive
+- DWORD dwR = ::WaitForSingleObject(procHandle, 0);
+- ::CloseHandle(procHandle);
+- if (dwR == WAIT_TIMEOUT)
+- return true;
++ if (getLockInfo(&pid, &hostname, &appname)) {
++ if (hostname == QString::fromLocal8Bit(localHostName())) {
++ HANDLE procHandle = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
++ if (!procHandle)
++ return true;
++ // We got a handle but check if process is still alive
++ DWORD dwR = ::WaitForSingleObject(procHandle, 0);
++ ::CloseHandle(procHandle);
++ if (dwR == WAIT_TIMEOUT)
++ return true;
++ }
+ }
+ #endif // !Q_OS_WINRT
+ const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());
+diff --git a/qtbase/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/qtbase/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+index 77bef94..12bea67 100644
+--- a/qtbase/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
++++ b/qtbase/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+@@ -58,6 +58,7 @@ private slots:
+ void staleLongLockFromBusyProcess();
+ void staleLockRace();
+ void noPermissions();
++ void corruptedLockFile();
+
+ public:
+ QString m_helperApp;
+@@ -415,5 +416,21 @@ void tst_QLockFile::noPermissions()
+ QCOMPARE(int(lockFile.error()), int(QLockFile::PermissionError));
+ }
+
++void tst_QLockFile::corruptedLockFile()
++{
++ const QString fileName = dir.path() + "/corruptedLockFile";
++
++ {
++ // Create a empty file. Typically the result of a computer crash or hard disk full.
++ QFile file(fileName);
++ QVERIFY(file.open(QFile::WriteOnly));
++ }
++
++ QLockFile secondLock(fileName);
++ secondLock.setStaleLockTime(100);
++ QVERIFY(secondLock.tryLock(10000));
++ QCOMPARE(int(secondLock.error()), int(QLockFile::NoError));
++}
++
+ QTEST_MAIN(tst_QLockFile)
+ #include "tst_qlockfile.moc"
+--
+cgit v0.11.0
+
diff --git a/qt5/build/patches/qt5.qtbug-49061.patch b/qt5/build/patches/qt5.qtbug-49061.patch
new file mode 100644
index 00000000..d006edbe
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-49061.patch
@@ -0,0 +1,80 @@
+#
+# https://github.com/qt/qtbase/commit/494376f9.patch
+#
+From 494376f980e96339b6f1eff7c41336ca4d853065 Mon Sep 17 00:00:00 2001
+From: Thiago Macieira <thiago.macieira@intel.com>
+Date: Thu, 12 Nov 2015 10:14:51 -0800
+Subject: [PATCH] Stop unloading plugins in QPluginLoader and QFactoryLoader
+
+QPluginLoader hasn't unloaded in its destructor since Qt 5.0, but we
+missed the equivalent code in QFactoryLoader (which bypasses
+QPluginLoader). Besides, QPluginLoader::unload() was still doing
+unloading, which it won't anymore.
+
+Not unloading plugins is Qt's policy, as decided during the 5.0
+development process and reaffirmed now in 5.6. This is due to static
+data in plugins leaking out and remaining in use past the unloading of
+the plugin, causing crashes.
+
+This does not affect QLibrary and QLibrary::unload(). Those are meant
+for non-Qt loadable modules, so unloading them may be safe.
+
+Task-number: QTBUG-49061
+Discussed-on: http://lists.qt-project.org/pipermail/development/2015-November/023681.html
+Change-Id: I461e9fc7199748faa187ffff1416070f138df8db
+Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
+Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
+---
+ src/corelib/plugin/qfactoryloader.cpp | 6 ++++--
+ src/corelib/plugin/qpluginloader.cpp | 5 +++--
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
+index 53b38c3..c820d53 100644
+--- a/src/corelib/plugin/qfactoryloader.cpp
++++ b/src/corelib/plugin/qfactoryloader.cpp
+@@ -203,10 +203,12 @@ void QFactoryLoader::update()
+ ++keyUsageCount;
+ }
+ }
+- if (keyUsageCount || keys.isEmpty())
++ if (keyUsageCount || keys.isEmpty()) {
++ library->setLoadHints(QLibrary::PreventUnloadHint); // once loaded, don't unload
+ d->libraryList += library;
+- else
++ } else {
+ library->release();
++ }
+ }
+ }
+ #else
+diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
+index 62067c7..4752f69 100644
+--- a/src/corelib/plugin/qpluginloader.cpp
++++ b/src/corelib/plugin/qpluginloader.cpp
+@@ -154,6 +154,7 @@ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
+ : QObject(parent), d(0), did_load(false)
+ {
+ setFileName(fileName);
++ setLoadHints(QLibrary::PreventUnloadHint);
+ }
+
+ /*!
+@@ -348,7 +349,7 @@ static QString locatePlugin(const QString& fileName)
+ void QPluginLoader::setFileName(const QString &fileName)
+ {
+ #if defined(QT_SHARED)
+- QLibrary::LoadHints lh;
++ QLibrary::LoadHints lh = QLibrary::PreventUnloadHint;
+ if (d) {
+ lh = d->loadHints();
+ d->release();
+@@ -394,7 +395,7 @@ QString QPluginLoader::errorString() const
+ \brief Give the load() function some hints on how it should behave.
+
+ You can give hints on how the symbols in the plugin are
+- resolved. By default, none of the hints are set.
++ resolved. By default since Qt 5.7, QLibrary::PreventUnloadHint is set.
+
+ See the documentation of QLibrary::loadHints for a complete
+ description of how this property works.
diff --git a/qt5/build/patches/qt5.qtbug-49452.patch b/qt5/build/patches/qt5.qtbug-49452.patch
new file mode 100644
index 00000000..4549ff16
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-49452.patch
@@ -0,0 +1,58 @@
+From 6f423555eba55ccdf7287071e10576bc1b687fd2 Mon Sep 17 00:00:00 2001
+From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
+Date: Mon, 1 Aug 2016 13:39:53 +0200
+Subject: [PATCH] REG: Fix unwanted cache flush in Freetype engine
+
+The Freetype cache was almost completely disabled by
+134c6db8587a8ce156d4fa31ffa62605821851b2 because after that
+change, the lockedAlphaMapForGlyph() function would no longer
+cut off early for empty glyphs like spaces, but rather go
+through all alpha map functions before it realized that there
+was nothing to render. This would in turn invalidate the cache
+for every empty glyph, causing all glyphs to be rerendered for
+every isolated word.
+
+This change adds back a cut off. This is only needed in the
+lockedAlphaMapForGlyph() function, since the superclass implementation
+of the other alpha map functions already contains a cut off for
+width/height == 0.
+
+[ChangeLog][Qt Gui][Text] Fixed a performance regression in Freetype
+engine that was introduced in Qt 5.5.
+
+Change-Id: I381285939909e99cc5fb5f3497fecf9fa871f29a
+Task-number: QTBUG-49452
+Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
+---
+ src/gui/text/qfontengine_ft.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
+index 4de41df..7c878da 100644
+--- a/src/gui/text/qfontengine_ft.cpp
++++ b/src/gui/text/qfontengine_ft.cpp
+@@ -1716,7 +1716,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
+
+ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat)
+ {
+- if (glyph == Q_NULLPTR)
++ if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0)
+ return QImage();
+
+ QImage::Format format = QImage::Format_Invalid;
+@@ -1764,11 +1764,15 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe
+
+ currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat);
+
++ const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0;
+ if (!cacheEnabled && glyph != &emptyGlyph) {
+ currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy();
+ delete glyph;
+ }
+
++ if (!glyphHasGeometry)
++ return Q_NULLPTR;
++
+ if (currentlyLockedAlphaMap.isNull())
+ return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset);
+
diff --git a/qt5/build/patches/qt5.qtbug-51621.patch b/qt5/build/patches/qt5.qtbug-51621.patch
new file mode 100644
index 00000000..187a3d78
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-51621.patch
@@ -0,0 +1,39 @@
+build with explicitlib after all
+
+unlike speculated in 2fe363514, this is not a workaround at all: it
+causes that libraries' public link interfaces (LIBS) are exported in the
+first place. unlike with staticlib, this does not export LIBS_PRIVATE,
+so it wouldn't even be a particularly effective workaround for rpath
+brokenness anyway.
+
+the problem was pretty well hidden by the qt module system, which at the
+level of libraries is pretty redundant with the .prl file handling,
+which shows just how stupid the whole "design" is.
+
+unlike before, we now enable explicitlib for all libraries, not just qt
+modules - we enable create_prl for all of them as well, after all.
+
+an immediate effect of this change is that it fixes linking on RaspPI:
+the qtcore headers make the user code require linking libatomic, so we
+must add it to our public link interface.
+
+Task-number: QTBUG-51621
+Change-Id: I5742c88694db8e8a9b79d17222dc6df2b38e5ab2
+
+X-Git-Url: https://codereview.qt-project.org/gitweb?p=qt%2Fqtbase.git;a=blobdiff_plain;f=mkspecs%2Ffeatures%2Fqt_build_config.prf;h=b3081b960ec192c3421d7a1c2bd5a628f0ca8455;hp=518fd93f0457c6060721c38ad8b6a0286407e562;hb=268e7ee9778de79d2485bdd028721ec7adbc1324;hpb=495e8c205424253186bef47421de63534d23dd59
+
+diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf
+index 518fd93..b3081b9 100644
+--- a/mkspecs/features/qt_build_config.prf
++++ b/mkspecs/features/qt_build_config.prf
+@@ -72,6 +72,10 @@ CONFIG += \
+ # However, testcases should be still built with exceptions.
+ exceptions_off testcase_exceptions
+
++# Under Windows, this is neither necessary (transitive deps are automatically
++# resolved), nor functional (.res files end up in .prl files and break things).
++unix: CONFIG += explicitlib
++
+
+ defineTest(qtBuildPart) {
+ bp = $$eval($$upper($$section(_QMAKE_CONF_, /, -2, -2))_BUILD_PARTS)
diff --git a/qt5/build/patches/qt5.qtbug-51648.patch b/qt5/build/patches/qt5.qtbug-51648.patch
new file mode 100644
index 00000000..279839b0
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-51648.patch
@@ -0,0 +1,88 @@
+From b024fbe83863fc57364a52c717d5b43d654bdb5d Mon Sep 17 00:00:00 2001
+From: Weng Xuetian <wengxt@gmail.com>
+Date: Sat, 5 Mar 2016 12:23:21 -0800
+Subject: [PATCH] QtDBus: clean up signal hooks and object tree in
+ closeConnection
+
+If a QObject is added or passed as receiver to QDBusConnection::connect()
+and it is managed by Q_GLOBAL_STATIC or similar mechanism, it is
+possible that when that its destructor is called after the dbus daemon
+thread ends. In that case, QObject::destroyed connected via
+Qt::BlockingQueuedConnection to QDBusConnectionPrivate will cause dead
+lock since the thread is no longer processing events.
+
+Task-number: QTBUG-51648
+Change-Id: I1a1810a6d6d0234af0269d5f3fc1f54101bf1547
+---
+ src/dbus/qdbusconnection_p.h | 1 +
+ src/dbus/qdbusintegrator.cpp | 28 +++++++++++++++++++++++++++-
+ 2 files changed, 28 insertions(+), 1 deletion(-)
+
+diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
+index c77daf7..565eb83 100644
+--- a/src/dbus/qdbusconnection_p.h
++++ b/src/dbus/qdbusconnection_p.h
+@@ -254,6 +254,7 @@ private:
+ const QVector<int> &metaTypes, int slotIdx);
+
+ SignalHookHash::Iterator removeSignalHookNoLock(SignalHookHash::Iterator it);
++ void disconnectObjectTree(ObjectTreeNode &node);
+
+ bool isServiceRegisteredByThread(const QString &serviceName);
+
+diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
+index cd44861..a3cd47b 100644
+--- a/src/dbus/qdbusintegrator.cpp
++++ b/src/dbus/qdbusintegrator.cpp
+@@ -1030,7 +1030,6 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
+ qPrintable(name));
+
+ closeConnection();
+- rootNode.children.clear(); // free resources
+ qDeleteAll(cachedMetaObjects);
+
+ if (mode == ClientMode || mode == PeerMode) {
+@@ -1052,6 +1051,20 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
+ }
+ }
+
++void QDBusConnectionPrivate::disconnectObjectTree(QDBusConnectionPrivate::ObjectTreeNode &haystack)
++{
++ QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin();
++
++ while (it != haystack.children.end()) {
++ disconnectObjectTree(*it);
++ it++;
++ }
++
++ if (haystack.obj) {
++ haystack.obj->disconnect(this);
++ }
++}
++
+ void QDBusConnectionPrivate::closeConnection()
+ {
+ QDBusWriteLocker locker(CloseConnectionAction, this);
+@@ -1075,6 +1088,19 @@ void QDBusConnectionPrivate::closeConnection()
+ }
+
+ qDeleteAll(pendingCalls);
++
++ // clean up all signal hook and object tree, to avoid QObject::destroyed
++ // being activated to dbus daemon thread which already quits.
++ // dbus connection is already closed, so there is nothing we could do be clean
++ // up everything here.
++ SignalHookHash::iterator sit = signalHooks.begin();
++ while (sit != signalHooks.end()) {
++ sit.value().obj->disconnect(this);
++ sit++;
++ }
++
++ disconnectObjectTree(rootNode);
++ rootNode.children.clear(); // free resources
+ }
+
+ void QDBusConnectionPrivate::checkThread()
+--
+2.7.1
+
diff --git a/qt5/build/patches/qt5.qtbug-51649.patch b/qt5/build/patches/qt5.qtbug-51649.patch
new file mode 100644
index 00000000..3b7cf9ec
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-51649.patch
@@ -0,0 +1,159 @@
+From acde2e69df5dedc624674107596f276125e22864 Mon Sep 17 00:00:00 2001
+From: Weng Xuetian <wengxt@gmail.com>
+Date: Thu, 3 Mar 2016 21:56:53 -0800
+Subject: [PATCH] QtDBus: finish all pending call with error if disconnected
+
+libdbus will send a local signal if connection gets disconnected. When
+this happens, end all pending calls with QDBusError::Disconnected.
+
+Task-number: QTBUG-51649
+Change-Id: I5c7d2a468bb5da746d0c0e53e458c1e376f186a9
+---
+ src/dbus/dbus_minimal_p.h | 2 ++
+ src/dbus/qdbusintegrator.cpp | 26 +++++++++++++++++-----
+ src/dbus/qdbusutil_p.h | 6 +++++
+ .../dbus/qdbusconnection/tst_qdbusconnection.cpp | 22 ++++++++++++++++++
+ .../dbus/qdbusconnection/tst_qdbusconnection.h | 1 +
+ 5 files changed, 51 insertions(+), 6 deletions(-)
+
+diff --git a/src/dbus/dbus_minimal_p.h b/src/dbus/dbus_minimal_p.h
+index f0a2954..8f25b24 100644
+--- a/src/dbus/dbus_minimal_p.h
++++ b/src/dbus/dbus_minimal_p.h
+@@ -99,9 +99,11 @@ typedef dbus_uint32_t dbus_bool_t;
+ /* dbus-shared.h */
+ #define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
+ #define DBUS_PATH_DBUS "/org/freedesktop/DBus"
++#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
+ #define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
+ #define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable"
+ #define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
++#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
+
+ #define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
+ #define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */
+diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
+index cd44861..320419f 100644
+--- a/src/dbus/qdbusintegrator.cpp
++++ b/src/dbus/qdbusintegrator.cpp
+@@ -519,6 +519,14 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
+ switch (amsg.type()) {
+ case QDBusMessage::SignalMessage:
+ handleSignal(amsg);
++ // Check local disconnected signal from libdbus
++ if (amsg.interface() == QDBusUtil::dbusInterfaceLocal()
++ && amsg.path() == QDBusUtil::dbusPathLocal()
++ && amsg.member() == QDBusUtil::disconnected()
++ && !QDBusMessagePrivate::isLocal(amsg)) {
++ while (!pendingCalls.isEmpty())
++ processFinishedCall(pendingCalls.first());
++ }
+ // if there are any other filters in this DBusConnection,
+ // let them see the signal too
+ return false;
+@@ -1767,10 +1775,16 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call)
+
+ QDBusMessage &msg = call->replyMessage;
+ if (call->pending) {
+- // decode the message
+- DBusMessage *reply = q_dbus_pending_call_steal_reply(call->pending);
+- msg = QDBusMessagePrivate::fromDBusMessage(reply, connection->capabilities);
+- q_dbus_message_unref(reply);
++ // when processFinishedCall is called and pending call is not completed,
++ // it means we received disconnected signal from libdbus
++ if (q_dbus_pending_call_get_completed(call->pending)) {
++ // decode the message
++ DBusMessage *reply = q_dbus_pending_call_steal_reply(call->pending);
++ msg = QDBusMessagePrivate::fromDBusMessage(reply, connection->capabilities);
++ q_dbus_message_unref(reply);
++ } else {
++ msg = QDBusMessage::createError(QDBusError::Disconnected, QDBusUtil::disconnectedErrorMessage());
++ }
+ }
+ qDBusDebug() << connection << "got message reply:" << msg;
+
+@@ -2070,8 +2084,8 @@ void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *
+ pcall->pending = pending;
+ q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, 0);
+
+- // DBus won't notify us when a peer disconnects so we need to track these ourselves
+- if (mode == QDBusConnectionPrivate::PeerMode)
++ // DBus won't notify us when a peer disconnects or server terminates so we need to track these ourselves
++ if (mode == QDBusConnectionPrivate::PeerMode || mode == QDBusConnectionPrivate::ClientMode)
+ pendingCalls.append(pcall);
+
+ return;
+diff --git a/src/dbus/qdbusutil_p.h b/src/dbus/qdbusutil_p.h
+index 8f5ae92..ca70ff9 100644
+--- a/src/dbus/qdbusutil_p.h
++++ b/src/dbus/qdbusutil_p.h
+@@ -155,6 +155,8 @@ namespace QDBusUtil
+ { return QStringLiteral(DBUS_SERVICE_DBUS); }
+ inline QString dbusPath()
+ { return QStringLiteral(DBUS_PATH_DBUS); }
++ inline QString dbusPathLocal()
++ { return QStringLiteral(DBUS_PATH_LOCAL); }
+ inline QString dbusInterface()
+ {
+ // it's the same string, but just be sure
+@@ -165,8 +167,12 @@ namespace QDBusUtil
+ { return QStringLiteral(DBUS_INTERFACE_PROPERTIES); }
+ inline QString dbusInterfaceIntrospectable()
+ { return QStringLiteral(DBUS_INTERFACE_INTROSPECTABLE); }
++ inline QString dbusInterfaceLocal()
++ { return QStringLiteral(DBUS_INTERFACE_LOCAL); }
+ inline QString nameOwnerChanged()
+ { return QStringLiteral("NameOwnerChanged"); }
++ inline QString disconnected()
++ { return QStringLiteral("Disconnected"); }
+ inline QString disconnectedErrorMessage()
+ { return QStringLiteral("Not connected to D-Bus server"); }
+ }
+diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+index e91f87d..6c7e6b1 100644
+--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
++++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+@@ -1218,6 +1218,28 @@ void tst_QDBusConnection::callVirtualObjectLocal()
+ QCOMPARE(obj.replyArguments, subPathReply.arguments());
+ }
+
++void tst_QDBusConnection::pendingCallWhenDisconnected()
++{
++ QDBusServer *server = new QDBusServer;
++ QDBusConnection con = QDBusConnection::connectToPeer(server->address(), "disconnect");
++ QTestEventLoop::instance().enterLoop(2);
++ QVERIFY(!QTestEventLoop::instance().timeout());
++ QVERIFY(con.isConnected());
++
++ delete server;
++
++ // Make sure we call the method before we know it is disconnected.
++ QVERIFY(con.isConnected());
++ QDBusMessage message = QDBusMessage::createMethodCall("", "/", QString(), "method");
++ QDBusPendingCall reply = con.asyncCall(message);
++
++ QTestEventLoop::instance().enterLoop(2);
++ QVERIFY(!con.isConnected());
++ QVERIFY(reply.isFinished());
++ QVERIFY(reply.isError());
++ QVERIFY(reply.error().type() == QDBusError::Disconnected);
++}
++
+ QString MyObject::path;
+ QString MyObjectWithoutInterface::path;
+ QString MyObjectWithoutInterface::interface;
+diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
+index a53ba32..720e484 100644
+--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
++++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
+@@ -121,6 +121,7 @@ private slots:
+ void registerVirtualObject();
+ void callVirtualObject();
+ void callVirtualObjectLocal();
++ void pendingCallWhenDisconnected();
+
+ public:
+ QString serviceName() const { return "org.qtproject.Qt.Autotests.QDBusConnection"; }
+--
+2.7.1
+
diff --git a/qt5/build/patches/qt5.qtbug-51676.patch b/qt5/build/patches/qt5.qtbug-51676.patch
new file mode 100644
index 00000000..8672a213
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-51676.patch
@@ -0,0 +1,126 @@
+From 11c5e716b08b6b3c5a7c9fce96b0cde8624ec869 Mon Sep 17 00:00:00 2001
+From: Thiago Macieira <thiago.macieira@intel.com>
+Date: Tue, 15 Mar 2016 11:00:20 -0700
+Subject: [PATCH] Fix QtDBus deadlock inside kded/kiod
+
+Whenever a message spy was installed, we failed to actually process
+looped-back messages by queueing them for processing by the spy. That
+had as a consequence that the caller got an error reply. Worse, since
+the message had been queued, QtDBus would attempt to deliver it later.
+Since that message had isLocal==true, bad things happened inside the
+manager thread.
+
+The correct solution is not to queue the message for the filter. If the
+message is local, then simply deliver directly, as we're still in the
+user's thread. This used to be the behavior in Qt 5.5.
+
+Task-number: QTBUG-51676
+Change-Id: I1dc112894cde7121e8ce302ae51b438ade1ff612
+---
+ src/dbus/qdbusintegrator.cpp | 42 ++++++++++++++++++++++++++++++++----------
+ src/dbus/qdbusintegrator_p.h | 1 +
+ 2 files changed, 33 insertions(+), 10 deletions(-)
+
+diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
+index cd44861..478a2c4 100644
+--- a/src/dbus/qdbusintegrator.cpp
++++ b/src/dbus/qdbusintegrator.cpp
+@@ -481,6 +481,11 @@ QDBusSpyCallEvent::~QDBusSpyCallEvent()
+
+ void QDBusSpyCallEvent::placeMetaCall(QObject *)
+ {
++ invokeSpyHooks(msg, hooks, hookCount);
++}
++
++inline void QDBusSpyCallEvent::invokeSpyHooks(const QDBusMessage &msg, const Hook *hooks, int hookCount)
++{
+ // call the spy hook list
+ for (int i = 0; i < hookCount; ++i)
+ hooks[i](msg);
+@@ -509,7 +514,12 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
+ {
+ if (!ref.load())
+ return false;
+- if (!dispatchEnabled && !QDBusMessagePrivate::isLocal(amsg)) {
++
++ // local message are always delivered, regardless of filtering
++ // or whether the dispatcher is enabled
++ bool isLocal = QDBusMessagePrivate::isLocal(amsg);
++
++ if (!dispatchEnabled && !isLocal) {
+ // queue messages only, we'll handle them later
+ qDBusDebug() << this << "delivery is suspended";
+ pendingMessages << amsg;
+@@ -523,13 +533,23 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
+ // let them see the signal too
+ return false;
+ case QDBusMessage::MethodCallMessage:
+- // run it through the spy filters (if any) before the regular processing
++ // run it through the spy filters (if any) before the regular processing:
++ // a) if it's a local message, we're in the caller's thread, so invoke the filter directly
++ // b) if it's an external message, post to the main thread
+ if (Q_UNLIKELY(qDBusSpyHookList.exists()) && qApp) {
+ const QDBusSpyHookList &list = *qDBusSpyHookList;
+- qDBusDebug() << this << "invoking message spies";
+- QCoreApplication::postEvent(qApp, new QDBusSpyCallEvent(this, QDBusConnection(this),
+- amsg, list.constData(), list.size()));
+- return true;
++ if (isLocal) {
++ Q_ASSERT(QThread::currentThread() != thread());
++ qDBusDebug() << this << "invoking message spies directly";
++ QDBusSpyCallEvent::invokeSpyHooks(amsg, list.constData(), list.size());
++ } else {
++ qDBusDebug() << this << "invoking message spies via event";
++ QCoreApplication::postEvent(qApp, new QDBusSpyCallEvent(this, QDBusConnection(this),
++ amsg, list.constData(), list.size()));
++
++ // we'll be called back, so return
++ return true;
++ }
+ }
+
+ handleObjectCall(amsg);
+@@ -1451,9 +1471,9 @@ void QDBusConnectionPrivate::handleObjectCall(const QDBusMessage &msg)
+ // that means the dispatchLock mutex is locked
+ // must not call out to user code in that case
+ //
+- // however, if the message is internal, handleMessage was called
+- // directly and no lock is in place. We can therefore call out to
+- // user code, if necessary
++ // however, if the message is internal, handleMessage was called directly
++ // (user's thread) and no lock is in place. We can therefore call out to
++ // user code, if necessary.
+ ObjectTreeNode result;
+ int usedLength;
+ QThread *objThread = 0;
+@@ -1492,12 +1512,14 @@ void QDBusConnectionPrivate::handleObjectCall(const QDBusMessage &msg)
+ usedLength, msg));
+ return;
+ } else if (objThread != QThread::currentThread()) {
+- // synchronize with other thread
++ // looped-back message, targeting another thread:
++ // synchronize with it
+ postEventToThread(HandleObjectCallPostEventAction, result.obj,
+ new QDBusActivateObjectEvent(QDBusConnection(this), this, result,
+ usedLength, msg, &sem));
+ semWait = true;
+ } else {
++ // looped-back message, targeting current thread
+ semWait = false;
+ }
+ } // release the lock
+diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h
+index 2bbebdf..c0d9c22 100644
+--- a/src/dbus/qdbusintegrator_p.h
++++ b/src/dbus/qdbusintegrator_p.h
+@@ -145,6 +145,7 @@ public:
+ {}
+ ~QDBusSpyCallEvent();
+ void placeMetaCall(QObject *) Q_DECL_OVERRIDE;
++ static inline void invokeSpyHooks(const QDBusMessage &msg, const Hook *hooks, int hookCount);
+
+ QDBusConnection conn; // keeps the refcount in QDBusConnectionPrivate up
+ QDBusMessage msg;
+--
+2.7.1
+
diff --git a/qt5/build/patches/qt5.qtbug-51890.patch b/qt5/build/patches/qt5.qtbug-51890.patch
new file mode 100644
index 00000000..51168b90
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-51890.patch
@@ -0,0 +1,82 @@
+QTBUG-51890: qtwebengine fails to build with system nss 3.23
+Patch obtained from:
+https://github.com/qtproject/qtwebengine/commit/82900c7b96b2a6fb42fe3841df7685b820edd588.patch
+
+And modified to exclude the "Subproject commit" lines.
+
+# ----------------------------------------------------------------------------
+
+From 82900c7b96b2a6fb42fe3841df7685b820edd588 Mon Sep 17 00:00:00 2001
+From: Kai Koehne <kai.koehne@theqtcompany.com>
+Date: Thu, 24 Mar 2016 13:55:28 +0100
+Subject: [PATCH] Use system NSS only for certificate handling
+
+Compiling against NSS 3.23 fails with current Chromium. Also, with NSS
+3.21 there are failures connecting to e.g. google.com.
+
+Fix this by adapting the setup endorsed by upstream Chromium: BoringSSL
+is always used for cryptography, and NSS only for certificate handlng.
+
+Patches included in 3rdparty update:
+
+0a385bb [backport] Call EnsureNSSHttpIOInit in the chimera build.
+0472123 Fix build against newer NSS
+90c62c4 <third_party/libpng> [Backport] update to libpng 1.2.56
+34857b8 <third_party/libpng> [Backport] Stop large iCCP chunks causing delays and "Aw Snap!"
+
+Task-number: QTBUG-52193
+Task-number: QTBUG-51890
+Task-number: QTBUG-52068
+Change-Id: If8aaed9b9a09475c5ed0dfec64d31f45ce9670f5
+Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
+---
+ src/3rdparty | 2 +-
+ src/core/config/linux.pri | 9 ++++++---
+ tools/qmake/mkspecs/features/configure.prf | 4 ++--
+ 3 files changed, 9 insertions(+), 6 deletions(-)
+
+#diff --git a/src/3rdparty b/src/3rdparty
+#index 3b2b78c..0a385bb 160000
+#--- a/src/3rdparty
+#+++ b/src/3rdparty
+#@@ -1 +1 @@
+#-Subproject commit 3b2b78caa761db2b7b25dc51c3dae8316f595db1
+#+Subproject commit 0a385bb01d9cf060fae4c9d350ee98561654df96
+diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
+index 88c1a41..39eeb2a 100644
+--- a/src/core/config/linux.pri
++++ b/src/core/config/linux.pri
+@@ -18,11 +18,14 @@ GYP_CONFIG += \
+ use_gio=0 \
+ use_gnome_keyring=0 \
+ use_kerberos=0 \
+- use_pango=0
++ use_pango=0 \
++ use_openssl=1
+
+-!use?(nss) {
++use?(nss) {
++ GYP_CONFIG += use_nss_certs=1 \
++ use_openssl_certs=0
++} else {
+ GYP_CONFIG += use_nss_certs=0 \
+- use_openssl=1 \
+ use_openssl_certs=1
+ }
+
+diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf
+index 4cb4600..953572d 100644
+--- a/tools/qmake/mkspecs/features/configure.prf
++++ b/tools/qmake/mkspecs/features/configure.prf
+@@ -72,9 +72,9 @@ defineTest(runConfigure) {
+ defineTest(finalizeConfigure) {
+ linux {
+ use?(nss) {
+- log("SSL............................... Using system NSS$${EOL}")
++ log("Certificate handling.............. Using system NSS$${EOL}")
+ } else {
+- log("SSL............................... Using bundled BoringSSL$${EOL}")
++ log("Certificate handling.............. Using bundled BoringSSL$${EOL}")
+ }
+ use?(system_icu) {
+ packagesExist("icu-uc icu-i18n") {
diff --git a/qt5/build/patches/qt5.qtbug-51927.patch b/qt5/build/patches/qt5.qtbug-51927.patch
new file mode 100644
index 00000000..d253dc15
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-51927.patch
@@ -0,0 +1,185 @@
+From 5149aa68eca6ede8836ec4f07a14d22d9da9b161 Mon Sep 17 00:00:00 2001
+From: Mitch Curtis <mitch.curtis@qt.io>
+Date: Tue, 13 Sep 2016 12:42:12 +0200
+Subject: Fix crash on exit when using default property aliases with layouts
+
+The layout was being destroyed before the text, which meant that the
+removeItemChangeListener() call never got hit. To ensure that the
+listener is always removed, loop through each child in QQuickLayout's
+destructor.
+
+This is a manual cherry-pick of
+59c6c0e0b1b5b46747595a58e11311b7393d7e70.
+
+Task-number: QTBUG-51927
+Change-Id: I669f42beb8c3dd6b4b741cae0b16e017bb3409df
+Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
+---
+ src/imports/layouts/qquicklayout.cpp | 4 ++
+ .../qquicklayouts/data/rowlayout/Container.qml | 55 ++++++++++++++++++++++
+ .../qquicklayouts/data/rowlayout/ContainerUser.qml | 53 +++++++++++++++++++++
+ .../quick/qquicklayouts/data/tst_rowlayout.qml | 12 +++++
+ 4 files changed, 124 insertions(+)
+ create mode 100644 tests/auto/quick/qquicklayouts/data/rowlayout/Container.qml
+ create mode 100644 tests/auto/quick/qquicklayouts/data/rowlayout/ContainerUser.qml
+
+diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp
+index abc8f97..9914826 100644
+--- a/src/imports/layouts/qquicklayout.cpp
++++ b/src/imports/layouts/qquicklayout.cpp
+@@ -698,6 +698,10 @@ QQuickLayout::QQuickLayout(QQuickLayoutPrivate &dd, QQuickItem *parent)
+ QQuickLayout::~QQuickLayout()
+ {
+ d_func()->m_isReady = false;
++
++ const auto childItems = d_func()->childItems;
++ for (QQuickItem *child : childItems)
++ QQuickItemPrivate::get(child)->removeItemChangeListener(this, QQuickItemPrivate::SiblingOrder);
+ }
+
+ QQuickLayoutAttached *QQuickLayout::qmlAttachedProperties(QObject *object)
+diff --git a/tests/auto/quick/qquicklayouts/data/rowlayout/Container.qml b/tests/auto/quick/qquicklayouts/data/rowlayout/Container.qml
+new file mode 100644
+index 0000000..22205c1
+--- /dev/null
++++ b/tests/auto/quick/qquicklayouts/data/rowlayout/Container.qml
+@@ -0,0 +1,55 @@
++/****************************************************************************
++**
++** Copyright (C) 2016 The Qt Company Ltd.
++** Contact: http://www.qt.io/licensing/
++**
++** This file is part of the test suite of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:BSD$
++** You may use this file under the terms of the BSD license as follows:
++**
++** "Redistribution and use in source and binary forms, with or without
++** modification, are permitted provided that the following conditions are
++** met:
++** * Redistributions of source code must retain the above copyright
++** notice, this list of conditions and the following disclaimer.
++** * Redistributions in binary form must reproduce the above copyright
++** notice, this list of conditions and the following disclaimer in
++** the documentation and/or other materials provided with the
++** distribution.
++** * Neither the name of The Qt Company Ltd nor the names of its
++** contributors may be used to endorse or promote products derived
++** from this software without specific prior written permission.
++**
++**
++** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++
++import QtQuick 2.7
++import QtQuick.Layouts 1.3
++
++Item {
++ objectName: "qtbug51927-window"
++ visible: true
++
++ default property alias _contents: customContent.data
++
++ RowLayout {
++ id: customContent
++ objectName: "qtbug51927-columnLayout"
++ anchors.fill: parent
++ }
++}
+diff --git a/tests/auto/quick/qquicklayouts/data/rowlayout/ContainerUser.qml b/tests/auto/quick/qquicklayouts/data/rowlayout/ContainerUser.qml
+new file mode 100644
+index 0000000..ff7ce62
+--- /dev/null
++++ b/tests/auto/quick/qquicklayouts/data/rowlayout/ContainerUser.qml
+@@ -0,0 +1,53 @@
++/****************************************************************************
++**
++** Copyright (C) 2016 The Qt Company Ltd.
++** Contact: http://www.qt.io/licensing/
++**
++** This file is part of the test suite of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:BSD$
++** You may use this file under the terms of the BSD license as follows:
++**
++** "Redistribution and use in source and binary forms, with or without
++** modification, are permitted provided that the following conditions are
++** met:
++** * Redistributions of source code must retain the above copyright
++** notice, this list of conditions and the following disclaimer.
++** * Redistributions in binary form must reproduce the above copyright
++** notice, this list of conditions and the following disclaimer in
++** the documentation and/or other materials provided with the
++** distribution.
++** * Neither the name of The Qt Company Ltd nor the names of its
++** contributors may be used to endorse or promote products derived
++** from this software without specific prior written permission.
++**
++**
++** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++
++import QtQuick 2.6
++import QtQuick.Window 2.2
++
++Container {
++ visible: true
++
++ Text {
++ objectName: "qtbug51927-text"
++ text: qsTr("Hello World")
++ anchors.centerIn: parent
++ renderType: Text.QtRendering
++ }
++}
+diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+index 33b8fd0..2d4e227 100644
+--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
++++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+@@ -926,5 +926,17 @@ Item {
+ waitForRendering(layout)
+ layout.destroy()
+ }
++
++
++ function test_defaultPropertyAliasCrash() {
++ var containerUserComponent = Qt.createComponent("rowlayout/ContainerUser.qml");
++ compare(containerUserComponent.status, Component.Ready);
++
++ var containerUser = containerUserComponent.createObject(testCase);
++ verify(containerUser);
++
++ // Shouldn't crash.
++ containerUser.destroy();
++ }
+ }
+ }
+--
+cgit v1.0-4-g1e03
+
diff --git a/qt5/build/patches/qt5.qtbug-53237.patch b/qt5/build/patches/qt5.qtbug-53237.patch
new file mode 100644
index 00000000..c6d5739d
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-53237.patch
@@ -0,0 +1,90 @@
+From 8e889378115c69508b050a511621ac8e30ec4158 Mon Sep 17 00:00:00 2001
+From: Jesus Fernandez <jesus.fernandez@theqtcompany.com>
+Date: Mon, 13 Jun 2016 19:09:15 +0200
+Subject: [PATCH] Fix UNSIGNED values in QMYSQL
+
+The unsigned flag in columns was ignored when creating the list of
+bound values in a mysql table. So the result iteration with
+QSqlQuery::next stops after the first wrong truncated value.
+
+[ChangeLog][QtSql] Fixed QSqlQuery::prepare value truncation error when
+using UNSIGNED values in a MySQL database.
+
+Task-number: QTBUG-53969
+Task-number: QTBUG-53237
+Change-Id: I10d977993445f2794f1dd8c88b2e83517ef524f3
+Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
+---
+ src/sql/drivers/mysql/qsql_mysql.cpp | 1 +
+ tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 39 +++++++++++++++++++++++
+ 2 files changed, 40 insertions(+)
+
+diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
+index 96bdcc4..55bf499 100644
+--- a/src/sql/drivers/mysql/qsql_mysql.cpp
++++ b/src/sql/drivers/mysql/qsql_mysql.cpp
+@@ -387,6 +387,7 @@ bool QMYSQLResultPrivate::bindInValues()
+ bind->buffer_length = f.bufLength = fieldInfo->length + 1;
+ bind->is_null = &f.nullIndicator;
+ bind->length = &f.bufLength;
++ bind->is_unsigned = fieldInfo->flags & UNSIGNED_FLAG ? 1 : 0;
+ f.outField=field;
+
+ ++i;
+diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+index bd553d5..f1c4333 100644
+--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
++++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+@@ -233,6 +233,9 @@ private slots:
+ void QTBUG_36211_data() { generic_data("QPSQL"); }
+ void QTBUG_36211();
+
++ void QTBUG_53969_data() { generic_data("QMYSQL"); }
++ void QTBUG_53969();
++
+ void sqlite_constraint_data() { generic_data("QSQLITE"); }
+ void sqlite_constraint();
+
+@@ -3652,6 +3655,42 @@ void tst_QSqlQuery::QTBUG_36211()
+ }
+ }
+
++void tst_QSqlQuery::QTBUG_53969()
++{
++ QFETCH( QString, dbName );
++ QVector<int> values = QVector<int>() << 10 << 20 << 127 << 128 << 1, tableValues;
++ QSqlDatabase db = QSqlDatabase::database( dbName );
++ CHECK_DATABASE( db );
++ tableValues.reserve(values.size());
++ if (tst_Databases::getDatabaseType(db) == QSqlDriver::MySqlServer) {
++ const QString tableName(qTableName("bug53969", __FILE__, db));
++ tst_Databases::safeDropTable( db, tableName );
++
++ QSqlQuery q(db);
++ QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (id INT AUTO_INCREMENT PRIMARY KEY, "
++ "test_number TINYINT(3) UNSIGNED)")
++ .arg(tableName)));
++
++ QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (test_number) VALUES (:value)"));
++
++ QVector<int>::iterator begin = values.begin(), end = values.end(), it;
++ for (it = begin; it != end; ++it) {
++ q.bindValue(":value", *it);
++ QVERIFY_SQL(q, exec());
++ }
++
++ QVERIFY_SQL(q, prepare("SELECT test_number FROM " + tableName));
++ QVERIFY_SQL(q, exec());
++
++ while (q.next()) {
++ bool ok;
++ tableValues.push_back(q.value(0).toUInt(&ok));
++ QVERIFY(ok);
++ }
++ QCOMPARE(values, tableValues);
++ }
++}
++
+ void tst_QSqlQuery::oraOCINumber()
+ {
+ QFETCH( QString, dbName );
diff --git a/qt5/build/patches/qt5.qtbug-55583.patch b/qt5/build/patches/qt5.qtbug-55583.patch
new file mode 100644
index 00000000..804f5383
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-55583.patch
@@ -0,0 +1,41 @@
+#
+# https://github.com/qt/qtbase/commit/84ea00d4.patch
+#
+From 84ea00d47049d882f2fabf1446ec6c6eb5fe3038 Mon Sep 17 00:00:00 2001
+From: J-P Nurmi <jpnurmi@qt.io>
+Date: Tue, 6 Dec 2016 16:30:31 +0100
+Subject: [PATCH] QGtk3Dialog: don't crash on Wayland
+
+Check if it's an X11 window before calling XSetTransientForHint().
+No transient parent will be set for GTK+ dialogs on Wayland. That
+has to be implemented separately.
+
+Task-number: QTBUG-55583
+Change-Id: Iabc2a72681c8157bb2f2fe500892853aa397106b
+Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
+Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
+---
+ src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+index ba5089a..699b058 100644
+--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
++++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+@@ -135,10 +135,12 @@ bool QGtk3Dialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWind
+
+ GdkWindow *gdkWindow = gtk_widget_get_window(gtkWidget);
+ if (parent) {
+- GdkDisplay *gdkDisplay = gdk_window_get_display(gdkWindow);
+- XSetTransientForHint(gdk_x11_display_get_xdisplay(gdkDisplay),
+- gdk_x11_window_get_xid(gdkWindow),
+- parent->winId());
++ if (GDK_IS_X11_WINDOW(gdkWindow)) {
++ GdkDisplay *gdkDisplay = gdk_window_get_display(gdkWindow);
++ XSetTransientForHint(gdk_x11_display_get_xdisplay(gdkDisplay),
++ gdk_x11_window_get_xid(gdkWindow),
++ parent->winId());
++ }
+ }
+
+ if (modality != Qt::NonModal) {
diff --git a/qt5/build/patches/qt5.qtbug-60558.patch b/qt5/build/patches/qt5.qtbug-60558.patch
new file mode 100644
index 00000000..2d039203
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-60558.patch
@@ -0,0 +1,32 @@
+https://github.com/qt/qtbase/commit/f45c6c18.patch
+
+From f45c6c180463ccb6620e1d273a264f14a1204a93 Mon Sep 17 00:00:00 2001
+From: Thiago Macieira <thiago.macieira@intel.com>
+Date: Wed, 3 May 2017 14:08:50 -0700
+Subject: [PATCH] QInternal::unregisterCallback: don't crash on unregistering
+ during exit
+
+Task-number: QTBUG-60558
+Change-Id: Ica9894dc9b5e48278fd4fffd14bb34c6d98d2555
+Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
+---
+ src/corelib/global/qglobal.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
+index c37503f3db..22fc20d47e 100644
+--- a/src/corelib/global/qglobal.cpp
++++ b/src/corelib/global/qglobal.cpp
+@@ -3988,8 +3988,10 @@ bool QInternal::registerCallback(Callback cb, qInternalCallback callback)
+ bool QInternal::unregisterCallback(Callback cb, qInternalCallback callback)
+ {
+ if (cb >= 0 && cb < QInternal::LastCallback) {
+- QInternal_CallBackTable *cbt = global_callback_table();
+- return (bool) cbt->callbacks[cb].removeAll(callback);
++ if (global_callback_table.exists()) {
++ QInternal_CallBackTable *cbt = global_callback_table();
++ return (bool) cbt->callbacks[cb].removeAll(callback);
++ }
+ }
+ return false;
+ }
diff --git a/qt5/build/patches/qt5.qtbug-61140.patch b/qt5/build/patches/qt5.qtbug-61140.patch
new file mode 100644
index 00000000..17468a95
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-61140.patch
@@ -0,0 +1,101 @@
+https://github.com/qt/qtbase/commit/744fd39e.patch
+
+From 744fd39e66b0b44e65a2505d674fa1cda8b205a4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@qt.io>
+Date: Fri, 2 Jun 2017 11:09:55 +0200
+Subject: [PATCH] xcb: Don't destroy foreign windows
+
+We can't rely on virtual dispatch in the destructor.
+
+Task-number: QTBUG-61140
+Change-Id: Ib1026caf126095778c24254775cb5a0bfecf3a38
+Reviewed-by: Fabian Vogt
+Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
+---
+ src/plugins/platforms/xcb/qxcbintegration.cpp | 18 +-----------------
+ src/plugins/platforms/xcb/qxcbwindow.cpp | 16 ++++++++++------
+ src/plugins/platforms/xcb/qxcbwindow.h | 12 ++++++++++++
+ 3 files changed, 23 insertions(+), 23 deletions(-)
+
+diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
+index b414bee204..8e3ee20329 100644
+--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
++++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
+@@ -214,25 +214,9 @@ QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
+ return xcbWindow;
+ }
+
+-class QXcbForeignWindow : public QXcbWindow
+-{
+-public:
+- QXcbForeignWindow(QWindow *window, WId nativeHandle)
+- : QXcbWindow(window) { m_window = nativeHandle; }
+- ~QXcbForeignWindow() {}
+- bool isForeignWindow() const override { return true; }
+-
+-protected:
+- // No-ops
+- void create() override {}
+- void destroy() override {}
+-};
+-
+ QPlatformWindow *QXcbIntegration::createForeignWindow(QWindow *window, WId nativeHandle) const
+ {
+- QXcbWindow *xcbWindow = new QXcbForeignWindow(window, nativeHandle);
+- xcbWindow->create();
+- return xcbWindow;
++ return new QXcbForeignWindow(window, nativeHandle);
+ }
+
+ #ifndef QT_NO_OPENGL
+diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
+index 289d0720e7..d6c69d52ef 100644
+--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
++++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
+@@ -597,13 +597,17 @@ QXcbWindow::~QXcbWindow()
+ }
+
+ destroy();
++}
+
+- if (isForeignWindow()) {
+- if (connection()->mouseGrabber() == this)
+- connection()->setMouseGrabber(Q_NULLPTR);
+- if (connection()->mousePressWindow() == this)
+- connection()->setMousePressWindow(Q_NULLPTR);
+- }
++QXcbForeignWindow::~QXcbForeignWindow()
++{
++ // Clear window so that destroy() does not affect it
++ m_window = 0;
++
++ if (connection()->mouseGrabber() == this)
++ connection()->setMouseGrabber(nullptr);
++ if (connection()->mousePressWindow() == this)
++ connection()->setMousePressWindow(nullptr);
+ }
+
+ void QXcbWindow::destroy()
+diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
+index 56628094ee..f38343b6c2 100644
+--- a/src/plugins/platforms/xcb/qxcbwindow.h
++++ b/src/plugins/platforms/xcb/qxcbwindow.h
+@@ -278,6 +278,18 @@ public Q_SLOTS:
+ xcb_cursor_t m_currentBitmapCursor = XCB_CURSOR_NONE;
+ };
+
++class QXcbForeignWindow : public QXcbWindow
++{
++public:
++ QXcbForeignWindow(QWindow *window, WId nativeHandle)
++ : QXcbWindow(window) { m_window = nativeHandle; }
++ ~QXcbForeignWindow();
++ bool isForeignWindow() const override { return true; }
++
++protected:
++ void create() override {} // No-op
++};
++
+ QT_END_NAMESPACE
+
+ Q_DECLARE_METATYPE(QXcbWindow*)
diff --git a/qt5/build/patches/qt5.qtbug-66103.patch b/qt5/build/patches/qt5.qtbug-66103.patch
new file mode 100644
index 00000000..62d1b301
--- /dev/null
+++ b/qt5/build/patches/qt5.qtbug-66103.patch
@@ -0,0 +1,172 @@
+https://code.qt.io/cgit/qt/qtbase.git/patch/?id=4a7771f206d4b29be549d3827c36a46679d90de6
+
+From 4a7771f206d4b29be549d3827c36a46679d90de6 Mon Sep 17 00:00:00 2001
+From: Eike Hein <hein@kde.org>
+Date: Sun, 7 Jan 2018 13:02:01 +0900
+Subject: QSimpleDrag: Fix mouse release coords for delayed event transmission
+
+On platforms such as XCB, the drag cursor pixmap is shown via a window
+(a QShapedPixmapWindow) under the cursor.
+
+The mouse button release event at the end of the drag is received in
+this QXcbWindow, but intercepted by an event filter that QSimpleDrag
+installs on the QApplication. It then resends it unmodified(!) after
+the drag has ended and the drag pixmap window destroyed, causing it to
+be delivered to the new top-level window.
+
+The local coordinates in the unmodified QMouseEvent are local to the
+drag pixmap window and don't match the window it is delayed-transmitted
+to.
+
+This ends up having fatal, user-visible effects particularly in Qt
+Quick: QQuickWindow synthesizes a hover event once per frame using
+the last received mouse coordinates, here: the release posted by
+QSimpleDrag. This is done to update the hover event state for items
+under the cursor when the mouse hasn't moved (e.g. QQuickMouseArea::
+containsMouse). The bogus event coordinates in the release event then
+usually end up causing an item near the top-left of the QQuickWindow
+to assume it is hovered (because drag pixmap windows tend to be small),
+even when the mouse cursor is actually far away from it at the end of
+the drag.
+
+This shows up e.g. in the Plasma 5 desktop, where dragging an icon
+on the desktop will cause the icon at the top-left of the screen (if
+any) to switch to hovered state, as the release coordinates on the
+drag pixmap window (showing a dragged icon) fall into the geometry
+of the top-left icon.
+
+QSimpleDrag contains a topLevelAt() function to find the top-level
+window under the global cursor coordinates that is not the drag
+pixmap window. This is used by the drop event delivery code.
+
+This patch uses this function to find the relevant top-level window,
+then asks it to map the global cusor coordinates to its local
+coordinate system, then synthesizes a new QMouseEvent with local
+coordinates computed in this fashion. As a result the window now
+gets a release event with coordinates that make sense and are
+correct.
+
+Task-number: QTBUG-66103
+Change-Id: I04ebe6ccd4a991fdd4b540ff0227973ea8896a9d
+Reviewed-by: Eike Hein <hein@kde.org>
+Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
+---
+ src/gui/kernel/qsimpledrag.cpp | 32 +++++++++++++++++++++++++++-----
+ src/gui/kernel/qsimpledrag_p.h | 6 +++---
+ 2 files changed, 30 insertions(+), 8 deletions(-)
+
+diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
+index a1e25dc53c..87d3ba5915 100644
+--- a/src/gui/kernel/qsimpledrag.cpp
++++ b/src/gui/kernel/qsimpledrag.cpp
+@@ -58,6 +58,7 @@
+
+ #include <QtCore/QEventLoop>
+ #include <QtCore/QDebug>
++#include <QtCore/QLoggingCategory>
+
+ #include <private/qguiapplication_p.h>
+ #include <private/qdnd_p.h>
+@@ -69,6 +70,8 @@ QT_BEGIN_NAMESPACE
+
+ #ifndef QT_NO_DRAGANDDROP
+
++Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd")
++
+ static QWindow* topLevelAt(const QPoint &pos)
+ {
+ QWindowList list = QGuiApplication::topLevelWindows();
+@@ -94,10 +97,10 @@ static QWindow* topLevelAt(const QPoint &pos)
+ */
+
+ QBasicDrag::QBasicDrag() :
+- m_restoreCursor(false), m_eventLoop(0),
++ m_current_window(nullptr), m_restoreCursor(false), m_eventLoop(nullptr),
+ m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false),
+- m_drag(0), m_drag_icon_window(0), m_useCompositing(true),
+- m_screen(Q_NULLPTR)
++ m_drag(nullptr), m_drag_icon_window(nullptr), m_useCompositing(true),
++ m_screen(nullptr)
+ {
+ }
+
+@@ -161,6 +164,7 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
+ return true; // Eat all mouse move events
+ }
+ case QEvent::MouseButtonRelease:
++ {
+ disableEventFilter();
+ if (canDrop()) {
+ QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window);
+@@ -169,8 +173,25 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
+ cancel();
+ }
+ exitDndEventLoop();
+- QCoreApplication::postEvent(o, new QMouseEvent(*static_cast<QMouseEvent *>(e)));
++
++ // If a QShapedPixmapWindow (drag feedback) is being dragged along, the
++ // mouse event's localPos() will be relative to that, which is useless.
++ // We want a position relative to the window where the drag ends, if possible (?).
++ // If there is no such window (belonging to this Qt application),
++ // make the event relative to the window where the drag started. (QTBUG-66103)
++ const QMouseEvent *release = static_cast<QMouseEvent *>(e);
++ const QWindow *releaseWindow = topLevelAt(release->globalPos());
++ qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_current_window << "globalPos" << release->globalPos();
++ if (!releaseWindow)
++ releaseWindow = m_current_window;
++ QPoint releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPos()) : release->globalPos());
++ QMouseEvent *newRelease = new QMouseEvent(release->type(),
++ releaseWindowPos, releaseWindowPos, release->screenPos(),
++ release->button(), release->buttons(),
++ release->modifiers(), release->source());
++ QCoreApplication::postEvent(o, newRelease);
+ return true; // defer mouse release events until drag event loop has returned
++ }
+ case QEvent::MouseButtonDblClick:
+ case QEvent::Wheel:
+ return true;
+@@ -349,7 +370,7 @@ static inline QPoint fromNativeGlobalPixels(const QPoint &point)
+ into account.
+ */
+
+-QSimpleDrag::QSimpleDrag() : m_current_window(0)
++QSimpleDrag::QSimpleDrag()
+ {
+ }
+
+@@ -373,6 +394,7 @@ void QSimpleDrag::startDrag()
+ updateCursor(Qt::IgnoreAction);
+ }
+ setExecutedDropAction(Qt::IgnoreAction);
++ qCDebug(lcDnd) << "drag began from" << m_current_window<< "cursor pos" << QCursor::pos() << "can drop?" << canDrop();
+ }
+
+ void QSimpleDrag::cancel()
+diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
+index 0b8a0bc703..bbd7f7f4bb 100644
+--- a/src/gui/kernel/qsimpledrag_p.h
++++ b/src/gui/kernel/qsimpledrag_p.h
+@@ -105,6 +105,9 @@ protected:
+
+ QDrag *drag() const { return m_drag; }
+
++protected:
++ QWindow *m_current_window;
++
+ private:
+ void enableEventFilter();
+ void disableEventFilter();
+@@ -132,9 +135,6 @@ protected:
+ virtual void cancel() Q_DECL_OVERRIDE;
+ virtual void move(const QPoint &globalPos) Q_DECL_OVERRIDE;
+ virtual void drop(const QPoint &globalPos) Q_DECL_OVERRIDE;
+-
+-private:
+- QWindow *m_current_window;
+ };
+
+ #endif // QT_NO_DRAGANDDROP
+--
+cgit v1.1-6-g87c4
+
+
diff --git a/qt5/build/patches/qt5.whandle.patch b/qt5/build/patches/qt5.whandle.patch
new file mode 100644
index 00000000..4428974d
--- /dev/null
+++ b/qt5/build/patches/qt5.whandle.patch
@@ -0,0 +1,24 @@
+From: Ulf Hermann <ulf.hermann@theqtcompany.com>
+Date: Tue, 27 Oct 2015 14:25:42 +0000 (+0100)
+Subject: WIP: Also do hide/show via WA_OutsideWSRange for native widgets
+X-Git-Url: https://codereview.qt-project.org/gitweb?p=qt%2Fqtbase.git;a=commitdiff_plain;h=5ea44d1d516f0c68a6793279df5c1569ef9fadd2
+
+WIP: Also do hide/show via WA_OutsideWSRange for native widgets
+
+Task-number: QTBUG-48321
+Change-Id: I78ef29975181ee22429c9bd4b11d96d9e68b7a9c
+---
+
+diff --git a/qtbase/src/widgets/kernel/qwidget.cpp b/qtbase/src/widgets/kernel/qwidget.cpp
+index a006246..024005d 100644
+--- a/qtbase/src/widgets/kernel/qwidget.cpp
++++ b/qtbase/src/widgets/kernel/qwidget.cpp
+@@ -7169,7 +7169,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
+
+ bool needsShow = false;
+
+- if (q->isWindow()) {
++ if (q->isWindow() || q->windowHandle()) {
+ if (!(data.window_state & Qt::WindowFullScreen) && (w == 0 || h == 0)) {
+ q->setAttribute(Qt::WA_OutsideWSRange, true);
+ if (q->isVisible() && q->testAttribute(Qt::WA_Mapped))