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
=== modified file 'src/Ubuntu/Components/plugin/uclabel.cpp'
--- src/Ubuntu/Components/plugin/uclabel.cpp 2016-03-14 18:56:42 +0000
+++ src/Ubuntu/Components/plugin/uclabel.cpp 2016-03-25 10:23:59 +0000
@@ -105,7 +105,8 @@
105}105}
106UCLabel::~UCLabel()106UCLabel::~UCLabel()
107{107{
108 delete d_ptr;108 // disconnect functor, so QQuickItem's enabledChanged won't call into the invalid functor
109 disconnect(this, &UCLabel::enabledChanged, this, &UCLabel::postThemeChanged);
109}110}
110111
111QColor UCLabelPrivate::getDefaultColor(QQuickItem *item, UCTheme *theme)112QColor UCLabelPrivate::getDefaultColor(QQuickItem *item, UCTheme *theme)
112113
=== modified file 'src/Ubuntu/Components/plugin/uclabel.h'
--- src/Ubuntu/Components/plugin/uclabel.h 2016-03-11 19:28:41 +0000
+++ src/Ubuntu/Components/plugin/uclabel.h 2016-03-25 10:23:59 +0000
@@ -87,12 +87,10 @@
87 void fontSizeChanged();87 void fontSizeChanged();
8888
89private:89private:
90 QScopedPointer<UCLabelPrivate> d_ptr;
91 Q_DECLARE_PRIVATE_D(d_ptr.data(), UCLabel)
92 Q_DISABLE_COPY(UCLabel)
90 Q_PRIVATE_SLOT(d_func(), void updateRenderType())93 Q_PRIVATE_SLOT(d_func(), void updateRenderType())
91
92 UCLabelPrivate *d_ptr;
93 Q_DECLARE_PRIVATE(UCLabel)
94
95 Q_DISABLE_COPY(UCLabel)
96};94};
9795
98QML_DECLARE_TYPE(UCLabel)96QML_DECLARE_TYPE(UCLabel)
9997
=== modified file 'tests/unit_x11/tst_components/tst_label_extras.qml'
--- tests/unit_x11/tst_components/tst_label_extras.qml 2016-03-14 18:56:42 +0000
+++ tests/unit_x11/tst_components/tst_label_extras.qml 2016-03-25 10:23:59 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.417import QtQuick 2.4
18import QtTest 1.018import QtTest 1.0
19import Ubuntu.Test 1.019import Ubuntu.Test 1.3
20import Ubuntu.Components 1.320import Ubuntu.Components 1.3
2121
22Item {22Item {
@@ -43,6 +43,22 @@
43 }43 }
44 }44 }
4545
46 Component {
47 id: labelModel
48 ListView {
49 anchors.fill: parent
50 model: [ "Lorem ipsum dolor sit amet" ]
51 enabled: false
52 delegate: Label {
53 id: ubuntuIdLabel
54 objectName: "ubuntuIdLabel"
55 text: modelData
56 elide: Text.ElideRight
57 property string email: modelData
58 }
59 }
60 }
61
46 Loader {62 Loader {
47 id: testLoader63 id: testLoader
48 }64 }
@@ -77,5 +93,10 @@
77 theme.palette.normal.backgroundText = UbuntuColors.blue;93 theme.palette.normal.backgroundText = UbuntuColors.blue;
78 verify(test.color != theme.palette.normal.backgroundText);94 verify(test.color != theme.palette.normal.backgroundText);
79 }95 }
96
97 function test_label_destruction_crash_bug1560044() {
98 var test = loadTest(labelModel);
99 testLoader.sourceComponent = null;
100 }
80 }101 }
81}102}
82103
=== modified file 'tests/unit_x11/tst_components/tst_listitem_extras.qml'
--- tests/unit_x11/tst_components/tst_listitem_extras.qml 2015-10-26 11:48:44 +0000
+++ tests/unit_x11/tst_components/tst_listitem_extras.qml 2016-03-25 10:23:59 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.417import QtQuick 2.4
18import QtTest 1.018import QtTest 1.0
19import Ubuntu.Test 1.019import Ubuntu.Test 1.3
20import Ubuntu.Components 1.320import Ubuntu.Components 1.3
2121
22Item {22Item {

Subscribers

People subscribed via source and target branches