summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordan Markuš <gordan.markus@pelagicore.com>2017-04-11 15:04:05 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2017-04-12 16:05:22 +0200
commit5b0bb2babfa3b7116465d340cd1da2e9f9bedb78 (patch)
tree98c64607096be7b587655be6b186db8ffc28c4d4
parent817fc2a19b63908f0628f29c2940a1dc44563ef9 (diff)
downloadmeta-qt5-5b0bb2babfa3b7116465d340cd1da2e9f9bedb78.tar.gz
qtdeclarative: fix memory leaks
* Fix QQmlExpression leaking QQmlError objects * Fix V4 Javascript Engine creating duplicate entries * Fix memory leak in QQuickWindowPrivate::deliverTouchAsMouse Signed-off-by: Gordan Markuš <gordan.markus@pelagicore.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--recipes-qt/qt5/qtdeclarative/0001-Fix-QQmlExpression-leaking-QQmlError-objects.patch35
-rw-r--r--recipes-qt/qt5/qtdeclarative/0002-Fix-memory-leak-in-V4.patch44
-rw-r--r--recipes-qt/qt5/qtdeclarative/0003-fix-memory-leak-in-QQuickWindowPrivate-deliverTouchA.patch84
-rw-r--r--recipes-qt/qt5/qtdeclarative_git.bb6
4 files changed, 169 insertions, 0 deletions
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 @@
1From f9dcbf008b430aadd464985b7a618eca8173d264 Mon Sep 17 00:00:00 2001
2From: Robert Griebl <robert.griebl@pelagicore.com>
3Date: Thu, 23 Feb 2017 15:11:13 +0100
4Subject: [PATCH 1/3] Fix QQmlExpression leaking QQmlError objects
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9If the user doesn't clear any potential errors manually via clearError(),
10then do it automatically in the destructor. Found with valgrind.
11
12[ChangeLog][QtQml][QQmlExpression] Fixed memory leak
13
14Change-Id: If5b1181850c7463c939a7ba536d74e7054c53d60
15Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
16Signed-off-by: Gordan Markuš <gordan.markus@pelagicore.com>
17---
18 src/qml/qml/qqmlexpression.cpp | 1 +
19 1 file changed, 1 insertion(+)
20
21diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
22index 6afbd05..5cb3d4d 100644
23--- a/src/qml/qml/qqmlexpression.cpp
24+++ b/src/qml/qml/qqmlexpression.cpp
25@@ -200,6 +200,7 @@ QQmlExpression::QQmlExpression(QQmlContextData *ctxt, QObject *scope,
26 */
27 QQmlExpression::~QQmlExpression()
28 {
29+ clearError();
30 }
31
32 /*!
33--
342.9.3
35
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 @@
1From 80e63c5a2981473dd7ee3a4f382e54948bb99f75 Mon Sep 17 00:00:00 2001
2From: Gunnar Sletta <gunnar@crimson.no>
3Date: Thu, 19 Jan 2017 09:05:46 +0100
4Subject: [PATCH 2/3] Fix memory leak in V4
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Transitions contain both an id and a set of flags, but the sorting
10failed to take the flags into account in the operator<. As a result
11we would some times end up with duplicate entries if the same id
12was added multiple times with different flags.
13
14If the same id was added again and again with varying flags, this
15could lead to an ever expanding list filled with duplicate entries.
16
17Fix this by also taking flags into account in operator< so that
18operator< and operator== are symetric and the list gets correctly
19sorted.
20
21Change-Id: I762ec3f0c5b4ed9a1aecb9a883187a0445491591
22Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
23Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
24Signed-off-by: Gordan Markuš <gordan.markus@pelagicore.com>
25---
26 src/qml/jsruntime/qv4internalclass_p.h | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
28
29diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h
30index dcda949..1d8ef4b 100644
31--- a/src/qml/jsruntime/qv4internalclass_p.h
32+++ b/src/qml/jsruntime/qv4internalclass_p.h
33@@ -234,7 +234,7 @@ struct InternalClassTransition
34 { return id == other.id && flags == other.flags; }
35
36 bool operator<(const InternalClassTransition &other) const
37- { return id < other.id; }
38+ { return id < other.id || (id == other.id && flags < other.flags); }
39 };
40
41 struct InternalClass : public QQmlJS::Managed {
42--
432.9.3
44
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 @@
1From 6aa9001064c19e75e58c830eedc583e2342a7f20 Mon Sep 17 00:00:00 2001
2From: Shawn Rutledge <shawn.rutledge@qt.io>
3Date: Wed, 1 Feb 2017 12:06:26 +0100
4Subject: [PATCH 3/3] fix memory leak in
5 QQuickWindowPrivate::deliverTouchAsMouse
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10A QTouchEvent is allocated with a reduced subset of TouchPoints for
11each Item to which we attempt to deliver it, and thrown away afterwards.
12(Ιt's not efficient to heap-allocate it, but we can't avoid doing it
13at all without changing behavior.) So now it's stored in a QScopedPointer.
14
15Change-Id: I48badb493610d0a715e582a2eedae95e2006eb2b
16Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
17Signed-off-by: Gordan Markuš <gordan.markus@pelagicore.com>
18---
19 src/quick/items/qquickwindow.cpp | 14 +++++++-------
20 1 file changed, 7 insertions(+), 7 deletions(-)
21
22diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
23index 1297dde..c130aec 100644
24--- a/src/quick/items/qquickwindow.cpp
25+++ b/src/quick/items/qquickwindow.cpp
26@@ -629,8 +629,8 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
27
28 // FIXME: make this work for mouse events too and get rid of the asTouchEvent in here.
29 Q_ASSERT(pointerEvent->asPointerTouchEvent());
30- QTouchEvent *event = pointerEvent->asPointerTouchEvent()->touchEventForItem(item);
31- if (!event)
32+ QScopedPointer<QTouchEvent> event(pointerEvent->asPointerTouchEvent()->touchEventForItem(item));
33+ if (event.isNull())
34 return false;
35
36 // For each point, check if it is accepted, if not, try the next point.
37@@ -647,7 +647,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
38 break;
39
40 qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "->" << item;
41- QScopedPointer<QMouseEvent> mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event, item, false));
42+ QScopedPointer<QMouseEvent> mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event.data(), item, false));
43
44 // Send a single press and see if that's accepted
45 QCoreApplication::sendEvent(item, mousePress.data());
46@@ -661,7 +661,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
47 pointerEventPoint->setGrabber(item);
48
49 if (checkIfDoubleClicked(event->timestamp())) {
50- QScopedPointer<QMouseEvent> mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event, item, false));
51+ QScopedPointer<QMouseEvent> mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event.data(), item, false));
52 QCoreApplication::sendEvent(item, mouseDoubleClick.data());
53 event->setAccepted(mouseDoubleClick->isAccepted());
54 if (!mouseDoubleClick->isAccepted()) {
55@@ -678,7 +678,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
56 } else if (touchMouseDevice == device && p.id() == touchMouseId) {
57 if (p.state() & Qt::TouchPointMoved) {
58 if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) {
59- QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event, mouseGrabberItem, false));
60+ QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), mouseGrabberItem, false));
61 QCoreApplication::sendEvent(item, me.data());
62 event->setAccepted(me->isAccepted());
63 if (me->isAccepted()) {
64@@ -689,7 +689,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
65 // no grabber, check if we care about mouse hover
66 // FIXME: this should only happen once, not recursively... I'll ignore it just ignore hover now.
67 // hover for touch???
68- QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event, item, false));
69+ QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), item, false));
70 if (lastMousePosition.isNull())
71 lastMousePosition = me->windowPos();
72 QPointF last = lastMousePosition;
73@@ -707,7 +707,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
74 } else if (p.state() & Qt::TouchPointReleased) {
75 // currently handled point was released
76 if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) {
77- QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event, mouseGrabberItem, false));
78+ QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event.data(), mouseGrabberItem, false));
79 QCoreApplication::sendEvent(item, me.data());
80
81 if (item->acceptHoverEvents() && p.screenPos() != QGuiApplicationPrivate::lastCursorPosition) {
82--
832.9.3
84
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 = " \
14 file://LICENSE.FDL;md5=6d9f2a9af4c8b8c3c769f6cc1b6aaf7e \ 14 file://LICENSE.FDL;md5=6d9f2a9af4c8b8c3c769f6cc1b6aaf7e \
15" 15"
16 16
17SRC_URI += " \
18 file://0001-Fix-QQmlExpression-leaking-QQmlError-objects.patch \
19 file://0002-Fix-memory-leak-in-V4.patch \
20 file://0003-fix-memory-leak-in-QQuickWindowPrivate-deliverTouchA.patch \
21"
22
17DEPENDS += "qtbase" 23DEPENDS += "qtbase"
18 24
19PACKAGECONFIG ??= "qtxmlpatterns" 25PACKAGECONFIG ??= "qtxmlpatterns"