Merge lp:~aacid/unity8/lvwph_fix_crash_invalid_section_delegate into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 2410
Merged at revision: 2466
Proposed branch: lp:~aacid/unity8/lvwph_fix_crash_invalid_section_delegate
Merge into: lp:unity8
Diff against target: 75 lines (+24/-5)
3 files modified
plugins/Dash/listviewwithpageheader.cpp (+6/-4)
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp (+6/-0)
tests/plugins/Dash/listviewwithpageheadertestsection.qml (+12/-1)
To merge this branch: bzr merge lp:~aacid/unity8/lvwph_fix_crash_invalid_section_delegate
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Andrea Cimitan (community) Approve
Review via email: mp+295825@code.launchpad.net

Commit message

Fix crash if a component that is not an Item is given to sectionDelegate

It doesn't matter much since this is not a public component, but it is always nice to be correct

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Andrea Cimitan (cimi) wrote :

waiting CI but yeah seems good so far

Revision history for this message
Andrea Cimitan (cimi) wrote :

alpha-blended green CI! (you can't see it here, but is green :))

 * Did you perform an exploratory manual test run of the code change and any related functionality?
y
 * Did CI run pass? If not, please explain why.
y

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1357/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/1795
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/884
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/884
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/884
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1819
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1763
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1763
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1763
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1754/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1357/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Dash/listviewwithpageheader.cpp'
2--- plugins/Dash/listviewwithpageheader.cpp 2016-04-27 14:59:24 +0000
3+++ plugins/Dash/listviewwithpageheader.cpp 2016-05-26 12:41:15 +0000
4@@ -286,9 +286,11 @@
5 m_sectionDelegate = delegate;
6
7 m_topSectionItem = getSectionItem(QString(), false /*watchGeometry*/);
8- m_topSectionItem->setZ(3);
9- QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);
10- connect(m_topSectionItem, &QQuickItem::heightChanged, this, &ListViewWithPageHeader::stickyHeaderHeightChanged);
11+ if (m_topSectionItem) {
12+ m_topSectionItem->setZ(3);
13+ QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);
14+ connect(m_topSectionItem, &QQuickItem::heightChanged, this, &ListViewWithPageHeader::stickyHeaderHeightChanged);
15+ }
16
17 // TODO create sections for existing items
18
19@@ -775,7 +777,7 @@
20 }
21 m_sectionDelegate->completeCreate();
22
23- if (watchGeometry) {
24+ if (watchGeometry && sectionItem) {
25 QQuickItemPrivate::get(sectionItem)->addItemChangeListener(this, QQuickItemPrivate::Geometry);
26 }
27
28
29=== modified file 'tests/plugins/Dash/listviewwithpageheadersectiontest.cpp'
30--- tests/plugins/Dash/listviewwithpageheadersectiontest.cpp 2016-02-29 10:47:10 +0000
31+++ tests/plugins/Dash/listviewwithpageheadersectiontest.cpp 2016-05-26 12:41:15 +0000
32@@ -2195,6 +2195,12 @@
33 verifyItem(1, 240., 220., false, "halfheight", false);
34 }
35
36+ void testInvalidSectionDelegate()
37+ {
38+ lvwph->setProperty("useBrokenSectionDelegateComponent", true);
39+ scrollToBottom();
40+ }
41+
42 private:
43 QQuickView *view;
44 ListViewWithPageHeader *lvwph;
45
46=== modified file 'tests/plugins/Dash/listviewwithpageheadertestsection.qml'
47--- tests/plugins/Dash/listviewwithpageheadertestsection.qml 2016-03-16 10:25:03 +0000
48+++ tests/plugins/Dash/listviewwithpageheadertestsection.qml 2016-05-26 12:41:15 +0000
49@@ -94,8 +94,13 @@
50 }
51 }
52
53+ property bool useBrokenSectionDelegateComponent: false
54 sectionProperty: "type"
55- sectionDelegate: Component {
56+ sectionDelegate: useBrokenSectionDelegateComponent ? objectComponent
57+ : regularSectionDelegateComponent
58+
59+ Component {
60+ id: regularSectionDelegateComponent
61 Rectangle {
62 color: "green"
63 height: section === "" ? 0 : section != "halfheight" ? 40 : 20;
64@@ -103,5 +108,11 @@
65 anchors { left: parent.left; right: parent.right }
66 }
67 }
68+
69+ Component {
70+ id: objectComponent
71+ QtObject {
72+ }
73+ }
74 }
75 }

Subscribers

People subscribed via source and target branches