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

Subscribers

People subscribed via source and target branches