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

Proposed by Zsombor Egri
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 1910
Merged at revision: 1912
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/labelCrash
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 93 lines (+28/-8)
4 files modified
src/Ubuntu/Components/plugin/uclabel.cpp (+2/-1)
src/Ubuntu/Components/plugin/uclabel.h (+3/-5)
tests/unit_x11/tst_components/tst_label_extras.qml (+22/-1)
tests/unit_x11/tst_components/tst_listitem_extras.qml (+1/-1)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/labelCrash
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Tim Peeters Approve
Zoltan Balogh Approve
Review via email: mp+290106@code.launchpad.net

Commit message

Disconnect enabled signal in Label in destructor, so functor call will not be handled when QQuickItem triggers enabled change.

To post a comment you must log in.
1910. By Zsombor Egri

fix

Revision history for this message
Zoltan Balogh (bzoltan) :
review: Approve
Revision history for this message
Tim Peeters (tpeeters) wrote :

Works

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/plugin/uclabel.cpp'
2--- src/Ubuntu/Components/plugin/uclabel.cpp 2016-03-14 18:56:42 +0000
3+++ src/Ubuntu/Components/plugin/uclabel.cpp 2016-03-25 10:23:59 +0000
4@@ -105,7 +105,8 @@
5 }
6 UCLabel::~UCLabel()
7 {
8- delete d_ptr;
9+ // disconnect functor, so QQuickItem's enabledChanged won't call into the invalid functor
10+ disconnect(this, &UCLabel::enabledChanged, this, &UCLabel::postThemeChanged);
11 }
12
13 QColor UCLabelPrivate::getDefaultColor(QQuickItem *item, UCTheme *theme)
14
15=== modified file 'src/Ubuntu/Components/plugin/uclabel.h'
16--- src/Ubuntu/Components/plugin/uclabel.h 2016-03-11 19:28:41 +0000
17+++ src/Ubuntu/Components/plugin/uclabel.h 2016-03-25 10:23:59 +0000
18@@ -87,12 +87,10 @@
19 void fontSizeChanged();
20
21 private:
22+ QScopedPointer<UCLabelPrivate> d_ptr;
23+ Q_DECLARE_PRIVATE_D(d_ptr.data(), UCLabel)
24+ Q_DISABLE_COPY(UCLabel)
25 Q_PRIVATE_SLOT(d_func(), void updateRenderType())
26-
27- UCLabelPrivate *d_ptr;
28- Q_DECLARE_PRIVATE(UCLabel)
29-
30- Q_DISABLE_COPY(UCLabel)
31 };
32
33 QML_DECLARE_TYPE(UCLabel)
34
35=== modified file 'tests/unit_x11/tst_components/tst_label_extras.qml'
36--- tests/unit_x11/tst_components/tst_label_extras.qml 2016-03-14 18:56:42 +0000
37+++ tests/unit_x11/tst_components/tst_label_extras.qml 2016-03-25 10:23:59 +0000
38@@ -16,7 +16,7 @@
39
40 import QtQuick 2.4
41 import QtTest 1.0
42-import Ubuntu.Test 1.0
43+import Ubuntu.Test 1.3
44 import Ubuntu.Components 1.3
45
46 Item {
47@@ -43,6 +43,22 @@
48 }
49 }
50
51+ Component {
52+ id: labelModel
53+ ListView {
54+ anchors.fill: parent
55+ model: [ "Lorem ipsum dolor sit amet" ]
56+ enabled: false
57+ delegate: Label {
58+ id: ubuntuIdLabel
59+ objectName: "ubuntuIdLabel"
60+ text: modelData
61+ elide: Text.ElideRight
62+ property string email: modelData
63+ }
64+ }
65+ }
66+
67 Loader {
68 id: testLoader
69 }
70@@ -77,5 +93,10 @@
71 theme.palette.normal.backgroundText = UbuntuColors.blue;
72 verify(test.color != theme.palette.normal.backgroundText);
73 }
74+
75+ function test_label_destruction_crash_bug1560044() {
76+ var test = loadTest(labelModel);
77+ testLoader.sourceComponent = null;
78+ }
79 }
80 }
81
82=== modified file 'tests/unit_x11/tst_components/tst_listitem_extras.qml'
83--- tests/unit_x11/tst_components/tst_listitem_extras.qml 2015-10-26 11:48:44 +0000
84+++ tests/unit_x11/tst_components/tst_listitem_extras.qml 2016-03-25 10:23:59 +0000
85@@ -16,7 +16,7 @@
86
87 import QtQuick 2.4
88 import QtTest 1.0
89-import Ubuntu.Test 1.0
90+import Ubuntu.Test 1.3
91 import Ubuntu.Components 1.3
92
93 Item {

Subscribers

People subscribed via source and target branches