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
=== modified file 'plugins/Dash/listviewwithpageheader.cpp'
--- plugins/Dash/listviewwithpageheader.cpp 2016-04-27 14:59:24 +0000
+++ plugins/Dash/listviewwithpageheader.cpp 2016-05-26 12:41:15 +0000
@@ -286,9 +286,11 @@
286 m_sectionDelegate = delegate;286 m_sectionDelegate = delegate;
287287
288 m_topSectionItem = getSectionItem(QString(), false /*watchGeometry*/);288 m_topSectionItem = getSectionItem(QString(), false /*watchGeometry*/);
289 m_topSectionItem->setZ(3);289 if (m_topSectionItem) {
290 QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);290 m_topSectionItem->setZ(3);
291 connect(m_topSectionItem, &QQuickItem::heightChanged, this, &ListViewWithPageHeader::stickyHeaderHeightChanged);291 QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);
292 connect(m_topSectionItem, &QQuickItem::heightChanged, this, &ListViewWithPageHeader::stickyHeaderHeightChanged);
293 }
292294
293 // TODO create sections for existing items295 // TODO create sections for existing items
294296
@@ -775,7 +777,7 @@
775 }777 }
776 m_sectionDelegate->completeCreate();778 m_sectionDelegate->completeCreate();
777779
778 if (watchGeometry) {780 if (watchGeometry && sectionItem) {
779 QQuickItemPrivate::get(sectionItem)->addItemChangeListener(this, QQuickItemPrivate::Geometry);781 QQuickItemPrivate::get(sectionItem)->addItemChangeListener(this, QQuickItemPrivate::Geometry);
780 }782 }
781783
782784
=== modified file 'tests/plugins/Dash/listviewwithpageheadersectiontest.cpp'
--- tests/plugins/Dash/listviewwithpageheadersectiontest.cpp 2016-02-29 10:47:10 +0000
+++ tests/plugins/Dash/listviewwithpageheadersectiontest.cpp 2016-05-26 12:41:15 +0000
@@ -2195,6 +2195,12 @@
2195 verifyItem(1, 240., 220., false, "halfheight", false);2195 verifyItem(1, 240., 220., false, "halfheight", false);
2196 }2196 }
21972197
2198 void testInvalidSectionDelegate()
2199 {
2200 lvwph->setProperty("useBrokenSectionDelegateComponent", true);
2201 scrollToBottom();
2202 }
2203
2198private:2204private:
2199 QQuickView *view;2205 QQuickView *view;
2200 ListViewWithPageHeader *lvwph;2206 ListViewWithPageHeader *lvwph;
22012207
=== modified file 'tests/plugins/Dash/listviewwithpageheadertestsection.qml'
--- tests/plugins/Dash/listviewwithpageheadertestsection.qml 2016-03-16 10:25:03 +0000
+++ tests/plugins/Dash/listviewwithpageheadertestsection.qml 2016-05-26 12:41:15 +0000
@@ -94,8 +94,13 @@
94 }94 }
95 }95 }
9696
97 property bool useBrokenSectionDelegateComponent: false
97 sectionProperty: "type"98 sectionProperty: "type"
98 sectionDelegate: Component {99 sectionDelegate: useBrokenSectionDelegateComponent ? objectComponent
100 : regularSectionDelegateComponent
101
102 Component {
103 id: regularSectionDelegateComponent
99 Rectangle {104 Rectangle {
100 color: "green"105 color: "green"
101 height: section === "" ? 0 : section != "halfheight" ? 40 : 20;106 height: section === "" ? 0 : section != "halfheight" ? 40 : 20;
@@ -103,5 +108,11 @@
103 anchors { left: parent.left; right: parent.right }108 anchors { left: parent.left; right: parent.right }
104 }109 }
105 }110 }
111
112 Component {
113 id: objectComponent
114 QtObject {
115 }
116 }
106 }117 }
107}118}

Subscribers

People subscribed via source and target branches