Merge lp:~zsombi/ubuntu-ui-toolkit/fix-style-lookup-crash into lp:ubuntu-ui-toolkit

Proposed by Zsombor Egri
Status: Merged
Approved by: Florian Boucault
Approved revision: 491
Merged at revision: 493
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/fix-style-lookup-crash
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 106 lines (+45/-3)
6 files modified
modules/Ubuntu/Components/plugin/itemstyleattached.cpp (+6/-1)
modules/Ubuntu/Components/plugin/ucstyle.cpp (+1/-1)
tests/unit/tst_theme_engine/StyleLookupCrash.qml (+26/-0)
tests/unit/tst_theme_engine/StyleLookupCrash.qmltheme (+1/-0)
tests/unit/tst_theme_engine/tst_theme_engine.pro (+3/-1)
tests/unit/tst_theme_engine/tst_theme_enginetest.cpp (+8/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/fix-style-lookup-crash
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+163735@code.launchpad.net

Commit message

Fix for crash in theme engine when loading application specific theme file in an app having a Popover instantiated.

Description of the change

Fix for crash in theme engine when loading application specific theme file in an app having a Popover instantiated.

To post a comment you must log in.
Revision history for this message
Zsombor Egri (zsombi) wrote :

Not ready yet, posted for testing purpose.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
489. By Zsombor Egri

test case extended to reproduce the crash on nexus 10

490. By Zsombor Egri

fix style cleanup

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

Tested with reverted media-player app workarounds.

491. By Zsombor Egri

link to the bug added

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

Ready for review. Tested with rolled back workaround on media-player application on Nexus 10.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/plugin/itemstyleattached.cpp'
2--- modules/Ubuntu/Components/plugin/itemstyleattached.cpp 2013-05-07 10:55:24 +0000
3+++ modules/Ubuntu/Components/plugin/itemstyleattached.cpp 2013-05-15 06:49:24 +0000
4@@ -358,8 +358,13 @@
5
6 // delete style also if there is an owner set to it
7 if (!customStyle || style->owner()) {
8- delete style;
9+ // reset style object before we delete it, themed animations may get changed
10+ // during the style deletion which will cause invalid pointer operations
11+ // in style bindings cleanup
12+ // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1175394
13+ QObject *object = style;
14 style = 0;
15+ delete object;
16 }
17 }
18
19
20=== modified file 'modules/Ubuntu/Components/plugin/ucstyle.cpp'
21--- modules/Ubuntu/Components/plugin/ucstyle.cpp 2013-05-01 19:19:22 +0000
22+++ modules/Ubuntu/Components/plugin/ucstyle.cpp 2013-05-15 06:49:24 +0000
23@@ -46,7 +46,7 @@
24 UCStyle::~UCStyle()
25 {
26 // we shouldn't have bindings by this time, but just in case...
27- QHashIterator<QString, QQmlProperty> i(m_bindings);
28+ QMutableHashIterator<QString, QQmlProperty> i(m_bindings);
29 while (i.hasNext()) {
30 i.next();
31 unbind(i.key());
32
33=== added file 'tests/unit/tst_theme_engine/StyleLookupCrash.qml'
34--- tests/unit/tst_theme_engine/StyleLookupCrash.qml 1970-01-01 00:00:00 +0000
35+++ tests/unit/tst_theme_engine/StyleLookupCrash.qml 2013-05-15 06:49:24 +0000
36@@ -0,0 +1,26 @@
37+/*
38+ * Copyright 2012 Canonical Ltd.
39+ *
40+ * This program is free software; you can redistribute it and/or modify
41+ * it under the terms of the GNU Lesser General Public License as published by
42+ * the Free Software Foundation; version 3.
43+ *
44+ * This program is distributed in the hope that it will be useful,
45+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
46+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+ * GNU Lesser General Public License for more details.
48+ *
49+ * You should have received a copy of the GNU Lesser General Public License
50+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
51+ */
52+import QtQuick 2.0
53+import Ubuntu.Components 0.1
54+import Ubuntu.Components.Popups 0.1
55+
56+Item {
57+ Popover {
58+ }
59+ Slider{
60+ }
61+ Component.onCompleted: Theme.loadTheme(Qt.resolvedUrl("StyleLookupCrash.qmltheme"))
62+}
63
64=== added file 'tests/unit/tst_theme_engine/StyleLookupCrash.qmltheme'
65--- tests/unit/tst_theme_engine/StyleLookupCrash.qmltheme 1970-01-01 00:00:00 +0000
66+++ tests/unit/tst_theme_engine/StyleLookupCrash.qmltheme 2013-05-15 06:49:24 +0000
67@@ -0,0 +1,1 @@
68+@import url(system:/Ambiance/qmltheme/default.qmltheme);
69
70=== modified file 'tests/unit/tst_theme_engine/tst_theme_engine.pro'
71--- tests/unit/tst_theme_engine/tst_theme_engine.pro 2013-04-30 22:38:24 +0000
72+++ tests/unit/tst_theme_engine/tst_theme_engine.pro 2013-05-15 06:49:24 +0000
73@@ -9,4 +9,6 @@
74 SelectorTest.qml \
75 InheritanceTest.qml \
76 MemoryCleanup.qml \
77- CustomStyles.qml
78+ CustomStyles.qml \
79+ StyleLookupCrash.qml \
80+ StyleLookupCrash.qmltheme
81
82=== modified file 'tests/unit/tst_theme_engine/tst_theme_enginetest.cpp'
83--- tests/unit/tst_theme_engine/tst_theme_enginetest.cpp 2013-05-07 10:55:24 +0000
84+++ tests/unit/tst_theme_engine/tst_theme_enginetest.cpp 2013-05-15 06:49:24 +0000
85@@ -67,6 +67,7 @@
86 void testCase_inheritance();
87 void testCase_MemoryCleanup();
88 void testCase_CustomTheme();
89+ void testCase_styleLookupCrash();
90 private:
91 bool check_properties(QObject *style, const QString &properties, bool xfail);
92 private:
93@@ -370,6 +371,13 @@
94 delete root;
95 }
96
97+void tst_ThemeEngine::testCase_styleLookupCrash()
98+{
99+ QQuickItem *root = loadTest("StyleLookupCrash.qml");
100+
101+ delete root;
102+}
103+
104 QTEST_MAIN(tst_ThemeEngine)
105
106 #include "tst_theme_enginetest.moc"

Subscribers

People subscribed via source and target branches

to status/vote changes: