From 5b0bb2babfa3b7116465d340cd1da2e9f9bedb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gordan=20Marku=C5=A1?= Date: Tue, 11 Apr 2017 15:04:05 +0200 Subject: qtdeclarative: fix memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix QQmlExpression leaking QQmlError objects * Fix V4 Javascript Engine creating duplicate entries * Fix memory leak in QQuickWindowPrivate::deliverTouchAsMouse Signed-off-by: Gordan Markuš Signed-off-by: Martin Jansa --- ...-QQmlExpression-leaking-QQmlError-objects.patch | 35 +++++++++ .../qtdeclarative/0002-Fix-memory-leak-in-V4.patch | 44 ++++++++++++ ...leak-in-QQuickWindowPrivate-deliverTouchA.patch | 84 ++++++++++++++++++++++ recipes-qt/qt5/qtdeclarative_git.bb | 6 ++ 4 files changed, 169 insertions(+) create mode 100644 recipes-qt/qt5/qtdeclarative/0001-Fix-QQmlExpression-leaking-QQmlError-objects.patch create mode 100644 recipes-qt/qt5/qtdeclarative/0002-Fix-memory-leak-in-V4.patch create mode 100644 recipes-qt/qt5/qtdeclarative/0003-fix-memory-leak-in-QQuickWindowPrivate-deliverTouchA.patch diff --git a/recipes-qt/qt5/qtdeclarative/0001-Fix-QQmlExpression-leaking-QQmlError-objects.patch b/recipes-qt/qt5/qtdeclarative/0001-Fix-QQmlExpression-leaking-QQmlError-objects.patch new file mode 100644 index 00000000..050a914e --- /dev/null +++ b/recipes-qt/qt5/qtdeclarative/0001-Fix-QQmlExpression-leaking-QQmlError-objects.patch @@ -0,0 +1,35 @@ +From f9dcbf008b430aadd464985b7a618eca8173d264 Mon Sep 17 00:00:00 2001 +From: Robert Griebl +Date: Thu, 23 Feb 2017 15:11:13 +0100 +Subject: [PATCH 1/3] Fix QQmlExpression leaking QQmlError objects +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If the user doesn't clear any potential errors manually via clearError(), +then do it automatically in the destructor. Found with valgrind. + +[ChangeLog][QtQml][QQmlExpression] Fixed memory leak + +Change-Id: If5b1181850c7463c939a7ba536d74e7054c53d60 +Reviewed-by: Simon Hausmann +Signed-off-by: Gordan Markuš +--- + src/qml/qml/qqmlexpression.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp +index 6afbd05..5cb3d4d 100644 +--- a/src/qml/qml/qqmlexpression.cpp ++++ b/src/qml/qml/qqmlexpression.cpp +@@ -200,6 +200,7 @@ QQmlExpression::QQmlExpression(QQmlContextData *ctxt, QObject *scope, + */ + QQmlExpression::~QQmlExpression() + { ++ clearError(); + } + + /*! +-- +2.9.3 + diff --git a/recipes-qt/qt5/qtdeclarative/0002-Fix-memory-leak-in-V4.patch b/recipes-qt/qt5/qtdeclarative/0002-Fix-memory-leak-in-V4.patch new file mode 100644 index 00000000..423681ee --- /dev/null +++ b/recipes-qt/qt5/qtdeclarative/0002-Fix-memory-leak-in-V4.patch @@ -0,0 +1,44 @@ +From 80e63c5a2981473dd7ee3a4f382e54948bb99f75 Mon Sep 17 00:00:00 2001 +From: Gunnar Sletta +Date: Thu, 19 Jan 2017 09:05:46 +0100 +Subject: [PATCH 2/3] Fix memory leak in V4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Transitions contain both an id and a set of flags, but the sorting +failed to take the flags into account in the operator<. As a result +we would some times end up with duplicate entries if the same id +was added multiple times with different flags. + +If the same id was added again and again with varying flags, this +could lead to an ever expanding list filled with duplicate entries. + +Fix this by also taking flags into account in operator< so that +operator< and operator== are symetric and the list gets correctly +sorted. + +Change-Id: I762ec3f0c5b4ed9a1aecb9a883187a0445491591 +Reviewed-by: Simon Hausmann +Reviewed-by: Robin Burchell +Signed-off-by: Gordan Markuš +--- + src/qml/jsruntime/qv4internalclass_p.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h +index dcda949..1d8ef4b 100644 +--- a/src/qml/jsruntime/qv4internalclass_p.h ++++ b/src/qml/jsruntime/qv4internalclass_p.h +@@ -234,7 +234,7 @@ struct InternalClassTransition + { return id == other.id && flags == other.flags; } + + bool operator<(const InternalClassTransition &other) const +- { return id < other.id; } ++ { return id < other.id || (id == other.id && flags < other.flags); } + }; + + struct InternalClass : public QQmlJS::Managed { +-- +2.9.3 + diff --git a/recipes-qt/qt5/qtdeclarative/0003-fix-memory-leak-in-QQuickWindowPrivate-deliverTouchA.patch b/recipes-qt/qt5/qtdeclarative/0003-fix-memory-leak-in-QQuickWindowPrivate-deliverTouchA.patch new file mode 100644 index 00000000..79a48f54 --- /dev/null +++ b/recipes-qt/qt5/qtdeclarative/0003-fix-memory-leak-in-QQuickWindowPrivate-deliverTouchA.patch @@ -0,0 +1,84 @@ +From 6aa9001064c19e75e58c830eedc583e2342a7f20 Mon Sep 17 00:00:00 2001 +From: Shawn Rutledge +Date: Wed, 1 Feb 2017 12:06:26 +0100 +Subject: [PATCH 3/3] fix memory leak in + QQuickWindowPrivate::deliverTouchAsMouse +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +A QTouchEvent is allocated with a reduced subset of TouchPoints for +each Item to which we attempt to deliver it, and thrown away afterwards. +(Ιt's not efficient to heap-allocate it, but we can't avoid doing it +at all without changing behavior.) So now it's stored in a QScopedPointer. + +Change-Id: I48badb493610d0a715e582a2eedae95e2006eb2b +Reviewed-by: Jan Arve Sæther +Signed-off-by: Gordan Markuš +--- + src/quick/items/qquickwindow.cpp | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp +index 1297dde..c130aec 100644 +--- a/src/quick/items/qquickwindow.cpp ++++ b/src/quick/items/qquickwindow.cpp +@@ -629,8 +629,8 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve + + // FIXME: make this work for mouse events too and get rid of the asTouchEvent in here. + Q_ASSERT(pointerEvent->asPointerTouchEvent()); +- QTouchEvent *event = pointerEvent->asPointerTouchEvent()->touchEventForItem(item); +- if (!event) ++ QScopedPointer event(pointerEvent->asPointerTouchEvent()->touchEventForItem(item)); ++ if (event.isNull()) + return false; + + // For each point, check if it is accepted, if not, try the next point. +@@ -647,7 +647,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve + break; + + qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "->" << item; +- QScopedPointer mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event, item, false)); ++ QScopedPointer mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event.data(), item, false)); + + // Send a single press and see if that's accepted + QCoreApplication::sendEvent(item, mousePress.data()); +@@ -661,7 +661,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve + pointerEventPoint->setGrabber(item); + + if (checkIfDoubleClicked(event->timestamp())) { +- QScopedPointer mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event, item, false)); ++ QScopedPointer mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event.data(), item, false)); + QCoreApplication::sendEvent(item, mouseDoubleClick.data()); + event->setAccepted(mouseDoubleClick->isAccepted()); + if (!mouseDoubleClick->isAccepted()) { +@@ -678,7 +678,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve + } else if (touchMouseDevice == device && p.id() == touchMouseId) { + if (p.state() & Qt::TouchPointMoved) { + if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) { +- QScopedPointer me(touchToMouseEvent(QEvent::MouseMove, p, event, mouseGrabberItem, false)); ++ QScopedPointer me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), mouseGrabberItem, false)); + QCoreApplication::sendEvent(item, me.data()); + event->setAccepted(me->isAccepted()); + if (me->isAccepted()) { +@@ -689,7 +689,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve + // no grabber, check if we care about mouse hover + // FIXME: this should only happen once, not recursively... I'll ignore it just ignore hover now. + // hover for touch??? +- QScopedPointer me(touchToMouseEvent(QEvent::MouseMove, p, event, item, false)); ++ QScopedPointer me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), item, false)); + if (lastMousePosition.isNull()) + lastMousePosition = me->windowPos(); + QPointF last = lastMousePosition; +@@ -707,7 +707,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve + } else if (p.state() & Qt::TouchPointReleased) { + // currently handled point was released + if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) { +- QScopedPointer me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event, mouseGrabberItem, false)); ++ QScopedPointer me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event.data(), mouseGrabberItem, false)); + QCoreApplication::sendEvent(item, me.data()); + + if (item->acceptHoverEvents() && p.screenPos() != QGuiApplicationPrivate::lastCursorPosition) { +-- +2.9.3 + diff --git a/recipes-qt/qt5/qtdeclarative_git.bb b/recipes-qt/qt5/qtdeclarative_git.bb index a620a00a..c19bbd56 100644 --- a/recipes-qt/qt5/qtdeclarative_git.bb +++ b/recipes-qt/qt5/qtdeclarative_git.bb @@ -14,6 +14,12 @@ LIC_FILES_CHKSUM = " \ file://LICENSE.FDL;md5=6d9f2a9af4c8b8c3c769f6cc1b6aaf7e \ " +SRC_URI += " \ + file://0001-Fix-QQmlExpression-leaking-QQmlError-objects.patch \ + file://0002-Fix-memory-leak-in-V4.patch \ + file://0003-fix-memory-leak-in-QQuickWindowPrivate-deliverTouchA.patch \ +" + DEPENDS += "qtbase" PACKAGECONFIG ??= "qtxmlpatterns" -- cgit v1.2.3 From e03d290bc00105908280820d866e074440ab6f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gordan=20Marku=C5=A1?= Date: Tue, 11 Apr 2017 16:04:33 +0200 Subject: qtwayland: fix initial window property values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a bug where there is nothing rendered on the QtWayland surface due to missing window properties. Signed-off-by: Gordan Markuš Signed-off-by: Martin Jansa --- ...l-window-property-values-being-propagated.patch | 35 ++++++++++++++++++++++ recipes-qt/qt5/qtwayland_git.bb | 5 +++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 recipes-qt/qt5/qtwayland/0002-Fix-initial-window-property-values-being-propagated.patch diff --git a/recipes-qt/qt5/qtwayland/0002-Fix-initial-window-property-values-being-propagated.patch b/recipes-qt/qt5/qtwayland/0002-Fix-initial-window-property-values-being-propagated.patch new file mode 100644 index 00000000..29c9180c --- /dev/null +++ b/recipes-qt/qt5/qtwayland/0002-Fix-initial-window-property-values-being-propagated.patch @@ -0,0 +1,35 @@ +From 3d30fd8df9b55449844207295ad3d51cc8bb44b1 Mon Sep 17 00:00:00 2001 +From: Robert Griebl +Date: Thu, 15 Dec 2016 17:43:00 +0100 +Subject: [PATCH 2/2] Fix initial window property values being propagated +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This was broken since the the shell-surface refactoring. + +Change-Id: I130b7396e85c570a9d11d609af6b3016e3f706f0 +Reviewed-by: Dominik Holland +Reviewed-by: Paul Olav Tvete +Signed-off-by: Gordan Markuš +--- + src/client/qwaylandwindow.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp +index c8be9c1..b6f16f0 100644 +--- a/src/client/qwaylandwindow.cpp ++++ b/src/client/qwaylandwindow.cpp +@@ -176,6 +176,9 @@ void QWaylandWindow::initWindow() + mShellSurface->setAppId(appId); + } + } ++ // the user may have already set some window properties, so make sure to send them out ++ for (auto it = m_properties.cbegin(); it != m_properties.cend(); ++it) ++ mShellSurface->sendProperty(it.key(), it.value()); + } + + // Enable high-dpi rendering. Scale() returns the screen scale factor and will +-- +2.9.3 + diff --git a/recipes-qt/qt5/qtwayland_git.bb b/recipes-qt/qt5/qtwayland_git.bb index d42d80a0..bcddb32c 100644 --- a/recipes-qt/qt5/qtwayland_git.bb +++ b/recipes-qt/qt5/qtwayland_git.bb @@ -44,6 +44,9 @@ EXTRA_QMAKEVARS_CONFIGURE += "${PACKAGECONFIG_CONFARGS}" SRCREV = "0e2a950895805457a45abe860bc91a7cc4ba405e" # From https://bugreports.qt.io/browse/QTBUG-57767 -SRC_URI += "file://0001-fix-build-without-xkbcommon-evdev.patch" +SRC_URI += " \ + file://0001-fix-build-without-xkbcommon-evdev.patch \ + file://0002-Fix-initial-window-property-values-being-propagated.patch \ +" BBCLASSEXTEND =+ "native nativesdk" -- cgit v1.2.3 From 5f837b47f5c3e462f24cd5abf58ff6ef1dd04932 Mon Sep 17 00:00:00 2001 From: Huang Qiyu Date: Wed, 12 Apr 2017 18:20:44 +0800 Subject: qttools: add ptest Add ptest for qttools by using provided testsuite. Signed-off-by: Huang Qiyu Signed-off-by: Martin Jansa --- recipes-qt/qt5/qttools/run-ptest | 4 ++++ recipes-qt/qt5/qttools_git.bb | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 recipes-qt/qt5/qttools/run-ptest diff --git a/recipes-qt/qt5/qttools/run-ptest b/recipes-qt/qt5/qttools/run-ptest new file mode 100644 index 00000000..5cd5e27e --- /dev/null +++ b/recipes-qt/qt5/qttools/run-ptest @@ -0,0 +1,4 @@ +#!/bin/sh + +./tst_qtdiag +./tst_qtattributionsscanner diff --git a/recipes-qt/qt5/qttools_git.bb b/recipes-qt/qt5/qttools_git.bb index a2b01be9..5c0f51cc 100644 --- a/recipes-qt/qt5/qttools_git.bb +++ b/recipes-qt/qt5/qttools_git.bb @@ -14,9 +14,12 @@ LIC_FILES_CHKSUM = " \ file://LICENSE.FDL;md5=6d9f2a9af4c8b8c3c769f6cc1b6aaf7e \ " +inherit ptest + DEPENDS += "qtbase qtdeclarative qtxmlpatterns" SRC_URI += " \ + file://run-ptest \ file://0002-assistant-help-fix-linking-of-dependent-libraries.patch \ file://0003-add-noqtwebkit-configuration.patch \ file://0004-linguist-tools-cmake-allow-overriding-the-location-f.patch \ @@ -33,3 +36,17 @@ EXTRA_QMAKEVARS_PRE += "${@bb.utils.contains('PACKAGECONFIG', 'qtwebkit', '', 'C SRCREV = "30c10900adecca55faa1d59c2f0caac74b1f9df6" BBCLASSEXTEND = "native nativesdk" + +do_compile_ptest() { + export PATH=${STAGING_DIR_NATIVE}/usr/include/qt5:$PATH + cd ${S}/tests + qmake -o Makefile tests.pro + oe_runmake +} + +do_install_ptest() { + mkdir -p ${D}${PTEST_PATH} + t=${D}${PTEST_PATH} + cp ${S}/tests/auto/qtdiag/tst_tdiag $t + cp ${S}/tests/auto/qtattributionsscanner/tst_qtattributionsscanner $t +} -- cgit v1.2.3