Merge lp:~zsombi/ubuntu-ui-toolkit/label_child_crash into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Rejected
Rejected by: Zsombor Egri
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/label_child_crash
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 72 lines (+55/-2)
2 files modified
src/Ubuntu/Components/plugin/ucthemingextension.cpp (+6/-2)
tests/unit_x11/tst_components/tst_label_extras.qml (+49/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/label_child_crash
Reviewer Review Type Date Requested Status
Zsombor Egri Disapprove
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+273794@code.launchpad.net

Commit message

Fixing corner case for Label having a styled child.

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

This makes sense indeed seeing that there is no 'theme' property in the case of the Label and Theme* would be null. Good catch!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Move the diff against trunk

review: Disapprove

Unmerged revisions

1680. By Zsombor Egri

fix

1679. By Zsombor Egri

test case reproducing the error

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/plugin/ucthemingextension.cpp'
--- src/Ubuntu/Components/plugin/ucthemingextension.cpp 2015-09-21 14:24:05 +0000
+++ src/Ubuntu/Components/plugin/ucthemingextension.cpp 2015-10-08 08:51:34 +0000
@@ -128,8 +128,12 @@
128 // make sure we have these handlers attached to each intermediate item128 // make sure we have these handlers attached to each intermediate item
129 QQuickItem *oldThemedAscendant = UCThemingExtension::ascendantThemed(m_prevParent);129 QQuickItem *oldThemedAscendant = UCThemingExtension::ascendantThemed(m_prevParent);
130 QQuickItem *newThemedAscendant = UCThemingExtension::ascendantThemed(newParent);130 QQuickItem *newThemedAscendant = UCThemingExtension::ascendantThemed(newParent);
131 UCTheme *oldTheme = oldThemedAscendant ? oldThemedAscendant->property("theme").value<UCTheme*>() : &UCTheme::defaultTheme();131 UCItemAttached *oldAscendantAttached = static_cast<UCItemAttached*>(qmlAttachedPropertiesObject<UCItemAttached>(oldThemedAscendant, false));
132 UCTheme *newTheme = newThemedAscendant ? newThemedAscendant->property("theme").value<UCTheme*>() : &UCTheme::defaultTheme();132 UCItemAttached *newAscendantAttached = static_cast<UCItemAttached*>(qmlAttachedPropertiesObject<UCItemAttached>(newThemedAscendant, false));
133 UCThemingExtension *oldAscendantExtension = oldAscendantAttached ? oldAscendantAttached->m_extension : Q_NULLPTR;
134 UCThemingExtension *newAscendantExtension = newAscendantAttached ? newAscendantAttached->m_extension : Q_NULLPTR;
135 UCTheme *oldTheme = oldAscendantExtension ? oldAscendantExtension->getTheme() : &UCTheme::defaultTheme();
136 UCTheme *newTheme = newAscendantExtension ? newAscendantExtension->getTheme() : &UCTheme::defaultTheme();
133137
134 if (oldTheme != newTheme) {138 if (oldTheme != newTheme) {
135 // send the event to m_item first139 // send the event to m_item first
136140
=== added file 'tests/unit_x11/tst_components/tst_label_extras.qml'
--- tests/unit_x11/tst_components/tst_label_extras.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/tst_label_extras.qml 2015-10-08 08:51:34 +0000
@@ -0,0 +1,49 @@
1/*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import QtTest 1.0
19import Ubuntu.Test 1.0
20import Ubuntu.Components 1.3
21
22Item {
23 id: main
24 width: units.gu(40)
25 height: units.gu(70)
26
27 Component {
28 id: labelWithButton
29 Label {
30 text: "Something"
31 Button {
32 objectName: "childButton"
33 text: "Something else"
34 onClicked: visible = false
35 }
36 }
37 }
38
39 UbuntuTestCase {
40 name: "Label13Extras"
41 when: windowShown
42
43 function test_label_with_button_bug1503901() {
44 // this should SEGFAULT on error!
45 var test = labelWithButton.createObject(main);
46 test.destroy();
47 }
48 }
49}

Subscribers

People subscribed via source and target branches