Merge lp:~timo-jyrinki/kubuntu-packaging/qtdeclarative_crashers_fixes_trigger_CI into lp:~kubuntu-packagers/kubuntu-packaging/qtdeclarative-opensource-src

Proposed by Timo Jyrinki
Status: Merged
Merged at revision: 173
Proposed branch: lp:~timo-jyrinki/kubuntu-packaging/qtdeclarative_crashers_fixes_trigger_CI
Merge into: lp:~kubuntu-packagers/kubuntu-packaging/qtdeclarative-opensource-src
Diff against target: 275 lines (+250/-0)
4 files modified
debian/changelog (+9/-0)
debian/patches/Avoid-race-condition-in-QQmlEngine-on-shutdown.patch (+84/-0)
debian/patches/Fix-crashes-when-calling-Array.sort-with-imperfect-s.patch (+155/-0)
debian/patches/series (+2/-0)
To merge this branch: bzr merge lp:~timo-jyrinki/kubuntu-packaging/qtdeclarative_crashers_fixes_trigger_CI
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Timo Jyrinki Approve
Review via email: mp+243974@code.launchpad.net

Commit message

* debian/patches/Avoid-race-condition-in-QQmlEngine-on-shutdown.patch
  - Cherry-pick an app shutdown crash fix (LP: #1373039)
* debian/patches/Fix-crashes-when-calling-Array.sort-with-imperfect-s.patch
  - Cherry-pick a fix for a crasher in Array.sort (LP: #1295119)

Description of the change

This MP got released already, MP done to get the CI triggered for updated code coverage numbers.

To post a comment you must log in.
Revision history for this message
Timo Jyrinki (timo-jyrinki) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Let's try one more time. Already merged, but CI has fixed some e-mail issues in the infrastructure.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Ok giving up, now it's broken since it's looking at the (obsolete) qt5-beta2 PPA.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-10-27 05:58:19 +0000
3+++ debian/changelog 2014-12-08 11:05:28 +0000
4@@ -1,3 +1,12 @@
5+qtdeclarative-opensource-src (5.3.2-3ubuntu2) vivid; urgency=medium
6+
7+ * debian/patches/Avoid-race-condition-in-QQmlEngine-on-shutdown.patch
8+ - Cherry-pick an app shutdown crash fix (LP: #1373039)
9+ * debian/patches/Fix-crashes-when-calling-Array.sort-with-imperfect-s.patch
10+ - Cherry-pick a fix for a crasher in Array.sort (LP: #1295119)
11+
12+ -- Timo Jyrinki <timo-jyrinki@ubuntu.com> Wed, 03 Dec 2014 08:32:46 +0000
13+
14 qtdeclarative-opensource-src (5.3.2-3ubuntu1) vivid; urgency=medium
15
16 * New upstream release.
17
18=== added file 'debian/patches/Avoid-race-condition-in-QQmlEngine-on-shutdown.patch'
19--- debian/patches/Avoid-race-condition-in-QQmlEngine-on-shutdown.patch 1970-01-01 00:00:00 +0000
20+++ debian/patches/Avoid-race-condition-in-QQmlEngine-on-shutdown.patch 2014-12-08 11:05:28 +0000
21@@ -0,0 +1,84 @@
22+From 48d93e0d854b3f9a2486a2393fee38496fd57bd9 Mon Sep 17 00:00:00 2001
23+From: Gunnar Sletta <gunnar.sletta@jollamobile.com>
24+Date: Tue, 1 Jul 2014 14:48:07 +0200
25+Subject: [PATCH] Avoid race condition in QQmlEngine on shutdown.
26+
27+The QQmlTypeLoader was deleted (and its thread shut down) when
28+the QQmlEnginePrivate was destroyed. However, the QQmlTypeLoader
29+runs a thread which would happiliy make calls on the engine and
30+its managed data. Fix this by stopping the QQmlTypeLoader's
31+thread right away in QQmlEngine.
32+
33+Task-number: QTBUG-39905
34+Change-Id: Ida8e95d083f79237c74b036fd3521133a9fa4ac7
35+Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
36+---
37+ src/qml/qml/qqmlengine.cpp | 2 ++
38+ src/qml/qml/qqmltypeloader.cpp | 15 ++++++++++++---
39+ src/qml/qml/qqmltypeloader_p.h | 1 +
40+ 3 files changed, 15 insertions(+), 3 deletions(-)
41+
42+diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
43+index 17e5c55..46fc329 100644
44+--- a/src/qml/qml/qqmlengine.cpp
45++++ b/src/qml/qml/qqmlengine.cpp
46+@@ -904,6 +904,8 @@ QQmlEngine::~QQmlEngine()
47+ if (d->isDebugging)
48+ QQmlDebugServer::instance()->removeEngine(this);
49+
50++ d->typeLoader.invalidate();
51++
52+ // Emit onDestruction signals for the root context before
53+ // we destroy the contexts, engine, Singleton Types etc. that
54+ // may be required to handle the destruction signal.
55+diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
56+index 1afc5bb..c5a4d65 100644
57+--- a/src/qml/qml/qqmltypeloader.cpp
58++++ b/src/qml/qml/qqmltypeloader.cpp
59+@@ -897,11 +897,20 @@ QQmlDataLoader::QQmlDataLoader(QQmlEngine *engine)
60+ /*! \internal */
61+ QQmlDataLoader::~QQmlDataLoader()
62+ {
63++ invalidate();
64++}
65++
66++void QQmlDataLoader::invalidate()
67++{
68+ for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter)
69+ (*iter)->release();
70++ m_networkReplies.clear();
71+
72+- shutdownThread();
73+- delete m_thread;
74++ if (m_thread) {
75++ shutdownThread();
76++ delete m_thread;
77++ m_thread = 0;
78++ }
79+ }
80+
81+ void QQmlDataLoader::lock()
82+@@ -1228,7 +1237,7 @@ void QQmlDataLoader::setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::Cached
83+
84+ void QQmlDataLoader::shutdownThread()
85+ {
86+- if (!m_thread->isShutdown())
87++ if (m_thread && !m_thread->isShutdown())
88+ m_thread->shutdown();
89+ }
90+
91+diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
92+index b09ac15..3d0b77e 100644
93+--- a/src/qml/qml/qqmltypeloader_p.h
94++++ b/src/qml/qml/qqmltypeloader_p.h
95+@@ -233,6 +233,7 @@ public:
96+
97+ QQmlEngine *engine() const;
98+ void initializeEngine(QQmlExtensionInterface *, const char *);
99++ void invalidate();
100+
101+ protected:
102+ void shutdownThread();
103+--
104+2.1.3
105+
106
107=== added file 'debian/patches/Fix-crashes-when-calling-Array.sort-with-imperfect-s.patch'
108--- debian/patches/Fix-crashes-when-calling-Array.sort-with-imperfect-s.patch 1970-01-01 00:00:00 +0000
109+++ debian/patches/Fix-crashes-when-calling-Array.sort-with-imperfect-s.patch 2014-12-08 11:05:28 +0000
110@@ -0,0 +1,155 @@
111+From 210475565969ca5381174016b47cd32ddc96eaed Mon Sep 17 00:00:00 2001
112+From: Lars Knoll <lars.knoll@digia.com>
113+Date: Thu, 12 Jun 2014 14:35:53 +0200
114+Subject: [PATCH] Fix crashes when calling Array.sort with imperfect sort
115+ functions
116+
117+We can't use std::sort to implement Array.sort. The reason is that
118+std::sort expects a conformant compare function, and can do weird
119+things (esp. crash) when the sort function isn't conformant.
120+
121+Falling back to qSort is not possible, as the method has been
122+deprecated. So add a copy of the qSort implementation here, and
123+use that one instead.
124+
125+Fix the sortint test in tst_qqmlecmascript to have a consistent
126+sort function for strings, as the result of calling sort is
127+otherwise undefined according to the ecma standard.
128+
129+Task-number: QTBUG-39072
130+Change-Id: I0602b3aa1ffa4de5006da58396f166805cf4a5e2
131+Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
132+Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
133+---
134+ src/qml/jsruntime/qv4arraydata.cpp | 56 +++++++++++++++++++++-
135+ tests/auto/qml/qjsengine/tst_qjsengine.cpp | 19 ++++++++
136+ .../auto/qml/qqmlecmascript/data/sequenceSort.qml | 2 +-
137+ 3 files changed, 75 insertions(+), 2 deletions(-)
138+
139+diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
140+index 7d76a10..9627848 100644
141+--- a/src/qml/jsruntime/qv4arraydata.cpp
142++++ b/src/qml/jsruntime/qv4arraydata.cpp
143+@@ -674,6 +674,60 @@ bool ArrayElementLessThan::operator()(Value v1, Value v2) const
144+ return p1s->toQString() < p2s->toQString();
145+ }
146+
147++template <typename RandomAccessIterator, typename T, typename LessThan>
148++void sortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan)
149++{
150++top:
151++ int span = int(end - start);
152++ if (span < 2)
153++ return;
154++
155++ --end;
156++ RandomAccessIterator low = start, high = end - 1;
157++ RandomAccessIterator pivot = start + span / 2;
158++
159++ if (lessThan(*end, *start))
160++ qSwap(*end, *start);
161++ if (span == 2)
162++ return;
163++
164++ if (lessThan(*pivot, *start))
165++ qSwap(*pivot, *start);
166++ if (lessThan(*end, *pivot))
167++ qSwap(*end, *pivot);
168++ if (span == 3)
169++ return;
170++
171++ qSwap(*pivot, *end);
172++
173++ while (low < high) {
174++ while (low < high && lessThan(*low, *end))
175++ ++low;
176++
177++ while (high > low && lessThan(*end, *high))
178++ --high;
179++
180++ if (low < high) {
181++ qSwap(*low, *high);
182++ ++low;
183++ --high;
184++ } else {
185++ break;
186++ }
187++ }
188++
189++ if (lessThan(*low, *end))
190++ ++low;
191++
192++ qSwap(*end, *low);
193++ sortHelper(start, low, t, lessThan);
194++
195++ start = low + 1;
196++ ++end;
197++ goto top;
198++}
199++
200++
201+ void ArrayData::sort(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn, uint len)
202+ {
203+ if (!len)
204+@@ -765,7 +819,7 @@ void ArrayData::sort(ExecutionContext *context, ObjectRef thisObject, const Valu
205+ ArrayElementLessThan lessThan(context, thisObject, comparefn);
206+
207+ Value *begin = thisObject->arrayData->data;
208+- std::sort(begin, begin + len, lessThan);
209++ sortHelper(begin, begin + len, *begin, lessThan);
210+
211+ #ifdef CHECK_SPARSE_ARRAYS
212+ thisObject->initSparseArray();
213+diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
214+index 51cd699..4b47e55 100644
215+--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
216++++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
217+@@ -135,6 +135,7 @@ private slots:
218+ void reentrancy_objectCreation();
219+ void jsIncDecNonObjectProperty();
220+ void JSONparse();
221++ void arraySort();
222+
223+ void qRegExpInport_data();
224+ void qRegExpInport();
225+@@ -2729,6 +2730,24 @@ void tst_QJSEngine::JSONparse()
226+ QVERIFY(ret.isObject());
227+ }
228+
229++void tst_QJSEngine::arraySort()
230++{
231++ // tests that calling Array.sort with a bad sort function doesn't cause issues
232++ // Using std::sort is e.g. not safe when used with a bad sort function and causes
233++ // crashes
234++ QJSEngine eng;
235++ eng.evaluate("function crashMe() {"
236++ " var data = [];"
237++ " for (var i = 0; i < 50; i++) {"
238++ " data[i] = 'whatever';"
239++ " }"
240++ " data.sort(function(a, b) {"
241++ " return -1;"
242++ " });"
243++ "}"
244++ "crashMe();");
245++}
246++
247+ static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; }
248+
249+ void tst_QJSEngine::qRegExpInport_data()
250+diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml b/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml
251+index 5e2892a..b130408 100644
252+--- a/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml
253++++ b/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml
254+@@ -23,7 +23,7 @@ Item {
255+ }
256+
257+ function compareStrings(a, b) {
258+- return (a < b) ? 1 : -1;
259++ return (a == b) ? 0 : ((a < b) ? 1 : -1);
260+ }
261+
262+ function compareNumbers(a, b) {
263+--
264+2.1.3
265+
266
267=== modified file 'debian/patches/series'
268--- debian/patches/series 2014-09-23 09:59:27 +0000
269+++ debian/patches/series 2014-12-08 11:05:28 +0000
270@@ -4,3 +4,5 @@
271 aarch64.patch
272 ppc64el.patch
273 Support-RFC2822Date-date-format-similar-to-V8.patch
274+Avoid-race-condition-in-QQmlEngine-on-shutdown.patch
275+Fix-crashes-when-calling-Array.sort-with-imperfect-s.patch

Subscribers

People subscribed via source and target branches