Merge lp:~mterry/unity8/tutorial-reappears into lp:unity8

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 1700
Merged at revision: 1717
Proposed branch: lp:~mterry/unity8/tutorial-reappears
Merge into: lp:unity8
Prerequisite: lp:~mterry/unity8/skip-spread-tutorial-on-desktop
Diff against target: 169 lines (+30/-47)
4 files modified
qml/Shell.qml (+25/-26)
qml/Tutorial/Tutorial.qml (+0/-14)
qml/Tutorial/TutorialContent.qml (+0/-7)
tests/qmltests/tst_Shell.qml (+5/-0)
To merge this branch: bzr merge lp:~mterry/unity8/tutorial-reappears
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Pending
Albert Astals Cid Pending
Review via email: mp+255191@code.launchpad.net

This proposal supersedes a proposal from 2015-03-26.

Commit message

Make sure the edge tutorial is destroyed when we receive a call during the wizard.

Description of the change

Make sure the edge tutorial is destroyed when we receive a call during the wizard.

Now... This bug doesn't make sense to me. What's happening is that the Tutorial.qml Loader is correctly marked as "active=false". But the loaded object is not actually released/destroyed.

I couldn't figure why this was happening. And I couldn't reproduce it via qmltests. In all cases I saw, the object was correctly destroyed. But I could reproduce the bug on the device. And adding log printfs indicated that yup, the object was staying around after Loader.active was false.

But on a hunch, cleaning up the object hierarchy helped. Before, each tutorial page would have a visual parent of "shell.stages" but a QtObject parent of the tutorial loader item. This is a leftover from before the latest tutorial redesign. Now visual parents *shouldn't* affect object lifecycle, I think...? But it seems like it does.

Because when I made the tutorial page's visual parents be the same as their QtObject parents (and just moved the whole Tutorial object underneath shell.stages), it worked fine. The tutorial objects were destroyed when the loader went inactive.

Do any Qml-heads know why this happens? I would guess some refcounting somewhere, but I don't know why I couldn't reproduce in qmltests.

I added some sanity checks at the end of the current test for wizard/tutorial early exit, which don't hurt. But even without my qml changes, they still pass (because I could never reproduce this bug in laboratory conditions).

== Checklist ==

 * Are there any related MPs required for this MP to build/function as expected? Please list.
 No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 Yes

 * Did you make sure that your branch does not contain spurious tags?
 Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
 NA

 * If you changed the UI, has there been a design review?
 NA

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote : Posted in a previous version of this proposal

(Oh yeah, and I cleared out a couple unused vestigial properties: stages and overlay)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass?
It passed up to the expected passing standards

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Shell.qml'
2--- qml/Shell.qml 2015-04-03 14:23:47 +0000
3+++ qml/Shell.qml 2015-04-03 14:23:47 +0000
4@@ -283,6 +283,31 @@
5 value: shell.background
6 }
7 }
8+
9+ Tutorial {
10+ id: tutorial
11+ objectName: "tutorial"
12+ anchors.fill: parent
13+ active: AccountsService.demoEdges
14+ paused: LightDM.Greeter.active
15+ launcher: launcher
16+ panel: panel
17+ edgeSize: shell.edgeSize
18+
19+ // EdgeDragAreas don't work with mice. So to avoid trapping the user,
20+ // we'll tell the tutorial to avoid using them on the Desktop. The
21+ // Desktop doesn't use the same spread design anyway. The tutorial is
22+ // all a bit of a placeholder on non-phone form factors right now.
23+ // When the design team gives us more guidance, we can do something
24+ // more clever here.
25+ // TODO: use DeviceConfiguration instead of checking source
26+ useEdgeDragArea: applicationsDisplayLoader.source != Qt.resolvedUrl("Stages/DesktopStage.qml")
27+
28+ onFinished: {
29+ AccountsService.demoEdges = false;
30+ active = false; // for immediate response / if AS is having problems
31+ }
32+ }
33 }
34
35 InputMethod {
36@@ -580,32 +605,6 @@
37 }
38 }
39
40- Tutorial {
41- id: tutorial
42- objectName: "tutorial"
43- active: AccountsService.demoEdges
44- paused: LightDM.Greeter.active
45- launcher: launcher
46- panel: panel
47- stages: stages
48- overlay: overlay
49- edgeSize: shell.edgeSize
50-
51- // EdgeDragAreas don't work with mice. So to avoid trapping the user,
52- // we'll tell the tutorial to avoid using them on the Desktop. The
53- // Desktop doesn't use the same spread design anyway. The tutorial is
54- // all a bit of a placeholder on non-phone form factors right now.
55- // When the design team gives us more guidance, we can do something
56- // more clever here.
57- // TODO: use DeviceConfiguration instead of checking source
58- useEdgeDragArea: applicationsDisplayLoader.source != Qt.resolvedUrl("Stages/DesktopStage.qml")
59-
60- onFinished: {
61- AccountsService.demoEdges = false;
62- active = false; // for immediate response / if AS is having problems
63- }
64- }
65-
66 Connections {
67 target: SessionBroadcast
68 onShowHome: showHome()
69
70=== modified file 'qml/Tutorial/Tutorial.qml'
71--- qml/Tutorial/Tutorial.qml 2015-04-03 14:23:47 +0000
72+++ qml/Tutorial/Tutorial.qml 2015-04-03 14:23:47 +0000
73@@ -27,8 +27,6 @@
74
75 property Item launcher
76 property Item panel
77- property Item stages
78- property Item overlay
79
80 readonly property bool launcherEnabled: loader.item ? loader.item.launcherEnabled : true
81 readonly property bool spreadEnabled: loader.item ? loader.item.spreadEnabled : true
82@@ -79,18 +77,6 @@
83 value: root.panel
84 }
85
86- Binding {
87- target: loader.item
88- property: "stages"
89- value: root.stages
90- }
91-
92- Binding {
93- target: loader.item
94- property: "overlay"
95- value: root.overlay
96- }
97-
98 Connections {
99 target: loader.item
100 onFinished: root.finished()
101
102=== modified file 'qml/Tutorial/TutorialContent.qml'
103--- qml/Tutorial/TutorialContent.qml 2015-04-03 14:23:47 +0000
104+++ qml/Tutorial/TutorialContent.qml 2015-04-03 14:23:47 +0000
105@@ -22,8 +22,6 @@
106
107 property Item launcher
108 property Item panel
109- property Item stages
110- property Item overlay
111
112 readonly property bool launcherEnabled: !running ||
113 (!paused && tutorialLeft.shown)
114@@ -67,7 +65,6 @@
115 TutorialLeft {
116 id: tutorialLeft
117 objectName: "tutorialLeft"
118- parent: root.stages
119 anchors.fill: parent
120 launcher: root.launcher
121 paused: !shown || root.paused
122@@ -78,7 +75,6 @@
123 TutorialLeftFinish {
124 id: tutorialLeftFinish
125 objectName: "tutorialLeftFinish"
126- parent: root.stages
127 anchors.fill: parent
128 textXOffset: root.launcher.panelWidth
129 paused: !shown || root.paused
130@@ -99,7 +95,6 @@
131 TutorialRight {
132 id: tutorialRight
133 objectName: "tutorialRight"
134- parent: root.stages
135 anchors.fill: parent
136 edgeSize: root.edgeSize
137 panel: root.panel
138@@ -111,7 +106,6 @@
139 TutorialBottom {
140 id: tutorialBottom
141 objectName: "tutorialBottom"
142- parent: root.stages
143 anchors.fill: parent
144 edgeSize: root.edgeSize
145 paused: !shown || root.paused
146@@ -122,7 +116,6 @@
147 TutorialBottomFinish {
148 id: tutorialBottomFinish
149 objectName: "tutorialBottomFinish"
150- parent: root.stages
151 anchors.fill: parent
152 backgroundFadesOut: true
153 paused: !shown || root.paused
154
155=== modified file 'tests/qmltests/tst_Shell.qml'
156--- tests/qmltests/tst_Shell.qml 2015-04-03 14:23:47 +0000
157+++ tests/qmltests/tst_Shell.qml 2015-04-03 14:23:47 +0000
158@@ -988,6 +988,11 @@
159 tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
160 compare(wizard.shown, false);
161 compare(tutorial.running, false);
162+ tryCompare(AccountsService, "demoEdges", false);
163+ tryCompare(Wizard.System, "wizardEnabled", false);
164+
165+ var tutorialLeft = findChild(tutorial, "tutorialLeft");
166+ compare(tutorialLeft, null); // should be destroyed with tutorial
167 }
168
169 function test_tapOnRightEdgeReachesApplicationSurface() {

Subscribers

People subscribed via source and target branches