<table><tr><td style="">rjvbb created this revision.<br />rjvbb added reviewers: Konsole, gateau.<br />rjvbb added a project: Konsole.<br />Herald added a subscriber: konsole-devel.<br />rjvbb requested review of this revision.
</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/D15295">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>An old commit (<a href="https://phabricator.kde.org/R319:dd1b2b4df04f13bb2a9f3bcef106dc3604c5fc1a" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">dd1b2b4d</a>) addressed a crash-on-exit (not well understood) by reverting to the old-style signal/slot connection syntax.</p>
<p>In practice, this prevented simply because the slot was never called, something I got wind when after installed the current tip of the master branch I started seeing this:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">QObject::connect: No such signal Konsole::TabbedViewContainer::destroyed(TabbedViewContainer*)</pre></div>
<p>Moving back to the new style syntax (after changing the signature of <tt style="background: #ebebeb; font-size: 13px;"> ViewSplitter::containerDestroyed</tt> to avoid having to use a complicated cast in the connect() call) the crash was indeed there anew because containerDestroyed was being called again.<br />
Analysing the backtrace showed that the containerDestroyed slot was called under the QSplitter::~QSplitter dtor, while deleting the splitter's child widgets.</p>
<p>In other words, the crash (inside QList::removeAll) seemed due to removing an item from a stale QList object. Vieplitter::containerDestroyed only serves to unregister a TabbedViewContainer that is about to be deleted; indeed, unregistering all registered containers in the new ViewSplitter::~ViewSplitter dtor fixes the crash.</p>
<p>My patch reverts both connections in ViewSplitter::registerContainer() to the new-style connection syntax.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Without the patch: no crash on exit because TabbedViewContainers aren't being unregistered at all<br />
With the patch: no crash on exit because they are unregistered while that is still possible.</p>
<p>I have not been able to test runtime invocation of ViewSplitter::containerDestroyed. I did notice that the qobject_cast in the patched slot fails if I do NOT emit the destroyed signal explicitly from the TabbedViewContainer dtor.</p>
<p>I do wonder about the remainder of the containerDestroyed function: will <tt style="background: #ebebeb; font-size: 13px;">count()</tt> already be 0 when the last container is *about* to be deleted?</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R319 Konsole</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15295">https://phabricator.kde.org/D15295</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/ViewSplitter.cpp<br />
src/ViewSplitter.h</div></div></div><br /><div><strong>To: </strong>rjvbb, Konsole, gateau<br /><strong>Cc: </strong>konsole-devel, KDE Applications, herrold, ngraham, maximilianocuria, hindenburg<br /></div>