<table><tr><td style="">davidedmundson created this revision.<br />davidedmundson added a reviewer: Plasma.<br />Restricted Application added a project: Plasma.<br />Restricted Application added a subscriber: plasma-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D2742" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The panel contains an invisible Item lastSpacer, who will fill the width<br />
of the layout if no other applet has Layout.fillWidth/Height set,<br />
keeping all applets left aligned.</p>
<p>Previous this worked by reparenting the invisible item in/out of the<br />
layout to the root item. This seems overkill when we can just toggle<br />
visibility. I think the code existed from before the panel was managed<br />
by a Layout.</p>
<p>Worse, the current code leads to a potential crash on teardown.<br />
The root gets deleted, starting a foreach(child, children)<br />
{child->delete}<br />
This kills the task bar, which means we reparent the spacer to the<br />
layout. The layout then finishes killing the children and kills the<br />
spacer. We then get back to the root objects dtor which is now deleting<br />
a previously deleted object. See bug report.</p>
<p>This patch also fixes the fact that addApplet/removeApplet had a<br />
slightly different check to see if the spacer is needed or not, fixing a<br />
hypothetical bug if you had a Hidden applet with fillWidth: true.</p>
<p>BUG: 357317</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>In both horizontal and vertical:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">have a panel without a task manager</li>
<li class="remarkup-list-item">add a task manager</li>
<li class="remarkup-list-item">remove a task manager</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>rPLASMADESKTOP Plasma Desktop</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D2742" rel="noreferrer">https://phabricator.kde.org/D2742</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>containments/panel/contents/code/LayoutManager.js<br />
containments/panel/contents/ui/main.qml</div></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>davidedmundson, Plasma<br /><strong>Cc: </strong>plasma-devel, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas<br /></div>